Commit af2e84642b05bd23e88181a45e425cd3868938f8

Authored by Adhidarma Hadiwinoto
1 parent b824c96947
Exists in master

bulks

Showing 2 changed files with 50 additions and 1 deletions Inline Diff

1 var http = require('http');
2 var url = require('url');
3 var fs = require('fs');
4 var ini = require('ini');
5 var config = ini.parse(fs.readFileSync(__dirname + '/config.ini', 'utf-8'));
6
7 var ym = require('yahoomessenger');
8 ym.newInstance();
9
10 function onReady(){
11 ym.login(config.globals.username, config.globals.password);
12 }
13
14 function onLoginSuccessful(data) {
15 console.log('Login successful as ' + data.firstname + ' ' + data.lastname + ' (' + data.username + ')');
16 console.log(data);
17 }
18
19 function onPm(data) {
20 console.log('onPM()');
21 console.log(data);
22 ym.sendPM(data.sender, "Pesan anda telah diterima dan akan segera diproses: " + data.message);
23 }
24
25 function onOfflinePM(data) {
26 console.log('onOfflinePM()');
27 console.log(data);
28 }
29
30 function onBuddyAddRequest(data) {
31 console.log('onBuddyAddRequest()');
32 console.log(data);
33 ym.acceptAddBuddy(data.username);
34 }
35
36 function createHttpServer() {
37 console.log('createHttpServer()');
38
39 var httpServer = http.createServer(function(request,response) {
40 var qs = url.parse(request.url, true).query;
41
42 });
43 }
44
45 ym.on('ready', onReady);
46 ym.on('loginSuccessful', onLoginSuccessful);
47 ym.on('pm', onPm);
48 ym.on('buddyAddRequest', onBuddyAddRequest);
49
1 { 1 {
2 "name": "evo-ym-center", 2 "name": "evo-ym-center",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "EVO YM Center", 4 "description": "EVO YM Center",
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "test": "mocha test" 7 "test": "mocha test"
8 }, 8 },
9 "repository": { 9 "repository": {
10 "type": "git", 10 "type": "git",
11 "url": "http://gitlab.kodesumber.com/adhisimon/evo-ym-center.git" 11 "url": "http://gitlab.kodesumber.com/adhisimon/evo-ym-center.git"
12 }, 12 },
13 "keywords": [ 13 "keywords": [
14 "evo", 14 "evo",
15 "guchi", 15 "guchi",
16 "gentong", 16 "gentong",
17 "yahoo", 17 "yahoo",
18 "ym", 18 "ym",
19 "ppob" 19 "ppob"
20 ], 20 ],
21 "author": "Adhidarma Hadiwinoto <gua@adhisimon.org>", 21 "author": "Adhidarma Hadiwinoto <gua@adhisimon.org>",
22 "license": "BSD", 22 "license": "BSD",
23 "dependencies": { 23 "dependencies": {
24 "ini": "~1.3.4", 24 "ini": "~1.3.4",
25 "yahoomessenger": "~0.1.3-Beta" 25 "yahoomessenger": "~0.1.3-Beta",
26 "url": "~0.11.0"
26 } 27 }
27 } 28 }
28 29