Hi James,

attached you will find a patch for PyMSN-t that introduces the <enableAutoInvite/> feature known from PyICQ-t and PyAIM-t: After the component is connected to the jabber server it probes presence from all registerered users triggering then to log in immediately.

To enable the feature insert an <enableAutoInvite/> node into your config.xml.

Thanks for integrating the patch into SVN. (I suppose it is not publicly writable?)

Regards,

-Michael

diff -rNu pymsnt.orig/trunk/src/config.py pymsnt/trunk/src/config.py
--- src/config.py	2007-03-07 17:03:29.000000000 +0100
+++ src/config.py	2007-03-07 17:07:17.000000000 +0100
@@ -37,3 +37,5 @@
 debugLevel = "0" # 0->None, 1->Traceback, 2->WARN,ERROR, 3->INFO,WARN,ERROR
 _debugLevel = 0 # Maintained by debug.reloadConfig as an int
 debugFile = ""
+
+enableAutoInvite = bool(False)
diff -rNu pymsnt.orig/trunk/src/main.py pymsnt/trunk/src/main.py
--- src/main.py	2007-03-07 17:03:29.000000000 +0100
+++ src/main.py	2007-03-07 17:08:27.000000000 +0100
@@ -228,6 +228,7 @@
 			x.attributes["protocol-version"] = "1.0"
 			x.attributes["config-ns"] = legacy.url + "/component"
 			self.send(pres)
+		self.sendInvitations()
 	
 	def componentDisconnected(self):
 		LogEvent(INFO)
@@ -325,6 +326,13 @@
 				#	# Send this subscription
 				#	s.onPresence(el)
 
+	def sendInvitations(self):
+		if config.enableAutoInvite:
+			for jid in self.xdb.getRegistrationList():
+				LogEvent(INFO, msg="Inviting %r" % jid)
+				jabw.sendPresence(self, jid, config.jid, ptype="probe")
+				jabw.sendPresence(self, jid, "%s/registered" % (config.jid), ptype="probe")
+
 
 class App:
 	def __init__(self):
diff -rNu pymsnt.orig/trunk/src/xdb.py pymsnt/trunk/src/xdb.py
--- src/xdb.py	2007-03-07 17:03:29.000000000 +0100
+++ src/xdb.py	2007-03-07 17:21:42.000000000 +0100
@@ -67,7 +67,11 @@
 			LogEvent(WARN, "", "IOError " + str(e))
 			raise
 		os.umask(prev_umask)
-	
+
+	def getRegistrationList(self):
+		""" Returns an array of all of the registered jids. """
+		return self.files()
+
 	def files(self):
 		""" Returns a list containing the files in the current XDB database """
 		files = []
_______________________________________________
py-transports mailing list
py-transports@blathersource.org
http://lists.modevia.com/cgi-bin/mailman/listinfo/py-transports

Reply via email to