Breaks a message from an IRC server into its origin, command, and arguments.
(self, line)
| 60 | |
| 61 | |
| 62 | def _parse_irc_msg(self, line): |
| 63 | """ |
| 64 | Breaks a message from an IRC server into its origin, command, and arguments. |
| 65 | """ |
| 66 | origin = '' |
| 67 | if not line: |
| 68 | return None, None, None |
| 69 | |
| 70 | if line[0] == ':': |
| 71 | origin, line = line[1:].split(' ', 1) |
| 72 | |
| 73 | if line.find(' :') != -1: |
| 74 | line, trailing = line.split(' :', 1) |
| 75 | args = line.split() |
| 76 | args.append(trailing) |
| 77 | |
| 78 | else: |
| 79 | args = line.split() |
| 80 | |
| 81 | command = args.pop(0) |
| 82 | |
| 83 | return origin, command, args |
| 84 | |
| 85 | |
| 86 | @lock |
no test coverage detected