Skip to content
This repository was archived by the owner on Feb 21, 2018. It is now read-only.

Commit 2a5067e

Browse files
committed
src/cod: handle \n termination better
1 parent 5f595cc commit 2a5067e

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/cod.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ def process(self, args):
497497
tbuf = self.link.recv(2048)
498498
tbuf = self.buf + tbuf
499499

500-
lines = tbuf.split("\r\n")
500+
lines = tbuf.split("\n")
501501

502502
self.buf = lines[-1]
503503
lines = lines[:-1]
@@ -511,11 +511,21 @@ def processLines(self, lines):
511511
"""
512512

513513
for line in lines:
514+
if len(line) == 0:
515+
continue
516+
517+
if line[-1] == "\r":
518+
line = line[:-1]
519+
514520
lineobj = IRCMessage(line)
515521

516522
#debug output
517523
if self.config["etc"]["debug"]:
518524
self.log(line, "<<<")
525+
#print "source: %s" % lineobj.source
526+
#print "verb: %s" % lineobj.verb
527+
#print "args: %s" % lineobj.args
528+
519529

520530
splitline = line.split()
521531

@@ -534,11 +544,10 @@ def processLines(self, lines):
534544
self.loadmod("admin") #Required to be hard-coded
535545

536546
self.bursted = True
537-
continue
538547

539-
if lineobj.verb == "ERROR":
540-
#If ERROR is sent, it's already fatal.
541-
raise KeyboardInterrupt
548+
if lineobj.verb == "ERROR":
549+
#If ERROR is sent, it's already fatal.
550+
raise KeyboardInterrupt
542551

543552
#Handle server commands
544553
try:

0 commit comments

Comments
 (0)