Author: ks156
Date: 2008-12-04 15:35:22 +0100 (Thu, 04 Dec 2008)
New Revision: 3009
Modified:
software_suite_v2/software/http_server_resources/chatter_tux/trunk/ChatterTux/chattertux.py
Log:
* Added the support for IRC
Modified:
software_suite_v2/software/http_server_resources/chatter_tux/trunk/ChatterTux/chattertux.py
===================================================================
---
software_suite_v2/software/http_server_resources/chatter_tux/trunk/ChatterTux/chattertux.py
2008-12-04 13:28:03 UTC (rev 3008)
+++
software_suite_v2/software/http_server_resources/chatter_tux/trunk/ChatterTux/chattertux.py
2008-12-04 14:35:22 UTC (rev 3009)
@@ -59,16 +59,29 @@
l4 = ip.child()
hl = l4.child()
text = hl.get_buffer_as_string()
- if str(ip.get_ip_src()).find(self.ip) != 0 and \
- text.find("MSG") == 0:
- text = text.split("\n")[5]
- text = text.replace(" ", "%20")
- text = text.replace("|", "§§§§§£")
- text = text.replace("&", "§§§§£")
- text = text.replace("+", "§§§£")
- urlTools.urllib2.urlopen(self.MSN_MSG_REQ %text)
+ # Only parse the incommings paquets
+ if str(ip.get_ip_src()).find(self.ip) != 0:
+ # Search for an IRC paquet
+ if text.find("PRIVMSG") >= 0:
+ text = text.split("PRIVMSG")[1]
+ text = text.split(":", 1)[1][1:]
+ print text
+ self.sendText(text)
+ # Search for a MSN paquet
+ elif text.find("MSG") >= 0:
+ text = text.split("\n")[5]
+ self.sendText(text)
except:
pass
+
+ def sendText(self, text):
+ text = text.replace(" ", "%20")
+ text = text.replace("|", "§§§§§£")
+ text = text.replace("&", "§§§§£")
+ text = text.replace("+", "§§§£")
+ urlTools.urllib2.urlopen(self.MSN_MSG_REQ%text)
+ print self.MSN_MSG_REQ %text
+
def layer4(self, seg):
l4_dic = { 6:'TCP', 17:'UDP' }
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn