File: send_message.py

package info (click to toggle)
pyxmpp 1.0.0-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 8,264 kB
  • ctags: 3,813
  • sloc: python: 10,243; ansic: 1,278; makefile: 119; xml: 73
file content (23 lines) | stat: -rwxr-xr-x 609 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/python -u
#
# A simple message-sending script

import sys

from pyxmpp.jid import JID
from pyxmpp.jabber.simple import send_message

if len(sys.argv)!=6:
    print u"Usage:"
    print "\t%s my_jid my_password recipient_jid subject body" % (sys.argv[0],)
    print "example:"
    print "\t%s test@localhost verysecret test1@localhost Test 'this is test'" % (sys.argv[0],)
    sys.exit(1)

jid,password,recpt,subject,body=sys.argv[1:]
jid=JID(jid)
if not jid.resource:
    jid=JID(jid.node,jid.domain,"send_message")
recpt=JID(recpt)
send_message(jid,password,recpt,body,subject)
# vi: sts=4 et sw=4