Created
March 20, 2014 20:17
-
-
Save skvark/595fd1e9b7a5b32f21b8 to your computer and use it in GitHub Desktop.
Sends a message via XMPP. Set your own jid and password and the target jid. Takes in args from command line and sends them as a message. Install xmpppy: pip install xmpppy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import xmpp | |
your_jid = "" | |
password = "" | |
target_jid = "" | |
def main(): | |
message = " ".join(sys.argv[1:]) | |
message = message.strip() | |
jid = xmpp.protocol.JID(your_jid) | |
client = xmpp.Client(jid.getDomain(), debug=[]) | |
client.connect() | |
client.auth(jid.getNode(), password) | |
client.sendInitPresence() | |
message = xmpp.Message(target_jid, message) | |
message.setAttr('type', 'chat') | |
client.send(message) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment