File: send_message.py

package info (click to toggle)
pyxmpp 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 11,004 kB
  • ctags: 20,065
  • sloc: python: 10,903; ansic: 1,300; makefile: 121; xml: 81
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