diff options
Diffstat (limited to 'warmachine.py')
| -rw-r--r-- | warmachine.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/warmachine.py b/warmachine.py index 0a358fc..769e7b6 100644 --- a/warmachine.py +++ b/warmachine.py | |||
| @@ -78,7 +78,17 @@ class irc: | |||
| 78 | """ | 78 | """ |
| 79 | while True: | 79 | while True: |
| 80 | data = self.irc.recv(4096) | 80 | data = self.irc.recv(4096) |
| 81 | #obj_data = parser.ircparse(data) | 81 | |
| 82 | if data == '': | ||
| 83 | continue | ||
| 84 | |||
| 85 | # Buffering for MOTD. | ||
| 86 | if data[-1] != '\n': | ||
| 87 | data = data + self.irc.recv(4096) | ||
| 88 | |||
| 89 | for line in data.split('\r\n'): | ||
| 90 | obj_data = parser.ircparse(line) | ||
| 91 | #pass to action handlers here... | ||
| 82 | 92 | ||
| 83 | # Passive Actions | 93 | # Passive Actions |
| 84 | try: | 94 | try: |
| @@ -97,14 +107,15 @@ class irc: | |||
| 97 | break | 107 | break |
| 98 | else: | 108 | else: |
| 99 | input = data.split() | 109 | input = data.split() |
| 100 | self.send('PRIVMSG ' + input[2] + ' :' + curuser + ': stop bothering me jerk.') | 110 | self.send('PRIVMSG ' + input[2] + ' :' + curuser + |
| 111 | ': stop bothering me jerk.') | ||
| 101 | except Exception,e: | 112 | except Exception,e: |
| 102 | print "Action failed" | 113 | print "Action failed" |
| 103 | print e | 114 | print e |
| 104 | 115 | ||
| 105 | 116 | ||
| 106 | if __name__ == '__main__': | 117 | if __name__ == '__main__': |
| 107 | i = irc('irc.efnet.org', 'warmachine', 'omgident') | 118 | i = irc('localhost', 'warmachine', 'omgident') |
| 108 | i.connect() | 119 | i.connect() |
| 109 | i.join('#zzq') | 120 | i.join('#zzq') |
| 110 | i.MainLoop() | 121 | i.MainLoop() |