Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of https://github.com/hj91/Using-XMPP-to-post-c…

  • Loading branch information...
commit 0d3944523b4fdb59ed7037259cf6eff034cefabd 2 parents 8c3a8c8 + 52e6422
Harshad Joshi authored
Showing with 12 additions and 4 deletions.
  1. +2 −1  README
  2. +1 −1  wp_post_class.py
  3. +9 −2 xmpp_to_wordpress.py
3  README
View
@@ -7,7 +7,8 @@ Requirements
- Wordpress blog with xml-rpc publishing enabled.
- XMPP chat server (openfire)
- Python 2.5 with xmpp and xml-rpc library.
-- Gammu SMS library version 1.27.0
+- Gammu SMS library version 1.27.
+- PyNotify to get updates on desktop (Linux only).
Features
- Unicode enabled
2  wp_post_class.py
View
@@ -15,7 +15,7 @@ def __init__(self,blog_name,user_name,user_pass,blog_id):
self.simulation = 0
def post(self,a,title):
- '''Contains XML-RPC procedures'''
+ '''Contains XML-RPC procedures'''
self.a= a # raw_input (" Enter a blog post >> ")
self.title = title #"Sent via IM client "#>>> "+c4+" " #+str(datetitle)
blog_content = { 'title' : str(self.title), 'description' : self.a+"\n" }
11 xmpp_to_wordpress.py
View
@@ -2,6 +2,8 @@
# Its a sort of federated microblogging with a database backend. Useful for storming sessions.
# Author - Harshad Joshi
# Date - 10 June 2010
+# Updates - 24 March 2012
+# Please check the commit data for more details.
#
# Requirements - Wordpress blog with xml-rpc publishing enabled.
# - XMPP chat server (openfire)
@@ -34,7 +36,7 @@
import sys
-
+import pynotify
import time
import datetime
import xml.sax.saxutils
@@ -61,7 +63,12 @@ def message_handler(connect_object,message_node):
command1=str(unicode(message_node.getBody()).encode('utf-8'))
command2=str(message_node.getFrom().getStripped())
c3=command2.replace("@"," [at] ")
- c4=c3.replace("."," [dot] ")
+ c4=c3.replace("."," [dot] ")
+ if not pynotify.init("Test Notification"):
+ sys.exit(1)
+ n = pynotify.Notification("Got this message", command1+ ">>" + command2)
+ if not n.show():
+ print "Failed to send notification"
#datetitle = datetime.datetime.now()
#title = "From xmpp client >> "+command2
title = "What I typed today from IM client >>> "+c4+" " #+str(datetitle)
Please sign in to comment.
Something went wrong with that request. Please try again.