45
|
1 |
import time |
|
2 |
import gtk |
|
3 |
import loudmouth |
|
4 |
|
|
5 |
lm = loudmouth |
|
6 |
|
|
7 |
conn = lm.Connection("jabber.org") |
|
8 |
conn.set_port(5222) |
|
9 |
|
|
10 |
def result_cb(conn, success): |
|
11 |
if success: |
|
12 |
print "Connection successful" |
|
13 |
else: |
|
14 |
print "Connection failed" |
|
15 |
gtk.mainquit() |
|
16 |
|
|
17 |
def auth_cb(conn, success): |
|
18 |
if success: |
|
19 |
print 'Auth successful' |
|
20 |
else: |
|
21 |
print "Auth failed" |
|
22 |
gtk.mainquit() |
|
23 |
|
|
24 |
conn.open(result_cb) |
|
25 |
conn.authenticate('jdahlin', 'amiga', 'gossip', auth_cb) |
|
26 |
msg = lm.Message("richard@imendio.com", lm.MESSAGE_TYPE_MESSAGE) |
|
27 |
conn.send_with_reply_and_block(msg) |
|
28 |
gtk.main() |