My favorites | Sign in
Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php

/*
* Author:
* Abhinav Singh
*
* Contact:
* mailsforabhinav@gmail.com
* admin@abhinavsingh.com
*
* Site:
* http://abhinavsingh.com
* http://abhinavsingh.com/blog
*
* Source:
* http://code.google.com/p/jaxl
*
* About:
* JAXL stands for "Just Another XMPP Library"
* For geeks, JAXL stands for "Jabber XMPP Library"
*
* I wrote this library while developing Gtalkbots (http://gtalkbots.com)
* I have highly customized it to work with Gtalk Servers and inspite of
* production level usage at Gtalkbots, I recommend still not to use this
* for any live project.
*
* Feel free to add me in Gtalk and drop an IM.
*
*/

/*
* ==================================== IMPORTANT =========================================
* JAXL extends XMPP and should be the starting point for all your applications
* You should never try to change XMPP class until you are confident about it
*
* Methods you might be interested in:
* eventMessage(), eventPresence()
* sendMessage($jid,$message), sendStatus($status)
* subscribe($jid)
* roster('get')
* roster('add',$jid)
* roster('remove',$jid)
* roster('update',$jid,$name,$groups)
* ==================================== IMPORTANT =========================================
*/

/* Include XMPP Class */
include_once("xmpp.class.php");

class JAXL extends XMPP {

function eventMessage($fromJid, $content, $offline = FALSE) {
// Not used here. See jaxl.class.php for it's use case
}

function eventPresence($fromJid, $status, $photo) {
// Not used here. See jaxl.class.php for it's use case
}

function eventNewEMail($total,$thread,$url,$participation,$messages,$date,$senders,$labels,$subject,$snippet) {
// Not used here. See jaxl.class.php for it's use case
}

function setStatus() {
// Set a custom status or use $this->status
$this->sendStatus($this->status);
print "Setting Status...\n";
print "Done\n";

/*
* Broadcast code starts from here
*/
foreach($this->rosterList as $buddy) {
print "Sending message to ".$buddy."\n";
$this->sendMessage($buddy,"Message broadcasted using *JAXL Library http://code.google.com/p/jaxl*");
sleep(1);
}

/* Now loggout of the system */
exit;
}

}

?>
Show details Hide details

Change log

r40 by mailsforabhinav on May 20, 2009   Diff
Checking in with updates comments and
introducing jaxl4broadcast.class.php for
broadcasting IM across your buddy list
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 2586 bytes, 85 lines
Hosted by Google Code