projects
/
bzrirker.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
22011d9
)
Truncate messages to some 'sensible' length before sending them to the irc server
author
Neil
<neil@dip.sun.ac.za>
Sun, 27 Jan 2013 11:10:29 +0000
(13:10 +0200)
committer
Neil
<neil@dip.sun.ac.za>
Sun, 27 Jan 2013 11:10:29 +0000
(13:10 +0200)
irkerhook.py
patch
|
blob
|
history
diff --git
a/irkerhook.py
b/irkerhook.py
index 48024d514fb24c50700bc62db812b641301f0f18..a1323b04a92b750a72f7d33b46177dcb96195268 100644
(file)
--- a/
irkerhook.py
+++ b/
irkerhook.py
@@
-113,9
+113,10
@@
class IrkerSender(object):
channels = self.config.get('irker_channels')
if channels:
channels = channels.split(',')
channels = self.config.get('irker_channels')
if channels:
channels = channels.split(',')
- msg = unicode(self._format())
- # We rely on the server truncating, rather than trying to be
- # too fancy here
+ # If we're too long, we might not get any notification, so
+ # we truncate the msg to max 450 chars, and hope that's
+ # going to be within the 510 irc limit
+ msg = unicode(self._format())[:450]
message = json.dumps({"to": channels, "privmsg": msg})
if channels:
# We assume tcp, since I'm lazy, so we just grab that bit
message = json.dumps({"to": channels, "privmsg": msg})
if channels:
# We assume tcp, since I'm lazy, so we just grab that bit