if channel not in self.channels_joined:
self.connection.join(channel)
self.irker.debug(1, "joining %s on %s." % (channel, self.servername))
- for segment in message.split("\n"):
- # Truncate the message if it's too long,
- # but we're working with characters here,
- # not bytes, so we could be off.
- # 500 = 512 - CRLF - 'PRIVMSG ' - ' :'
- maxlength = 500 - len(channel)
- if len(segment) > maxlength:
- segment = segment[:maxlength]
- try:
- self.connection.privmsg(channel, segment)
- except ValueError as err:
- self.irker.debug(1, "irclib rejected a message to %s on %s because: %s" % (channel, self.servername, str(err)))
- time.sleep(ANTI_FLOOD_DELAY)
+ # An empty message might be used as a keepalive or
+ # to join a channel for logging, so suppress the
+ # privmsg send unless there is actual traffic.
+ if message:
+ for segment in message.split("\n"):
+ # Truncate the message if it's too long,
+ # but we're working with characters here,
+ # not bytes, so we could be off.
+ # 500 = 512 - CRLF - 'PRIVMSG ' - ' :'
+ maxlength = 500 - len(channel)
+ if len(segment) > maxlength:
+ segment = segment[:maxlength]
+ try:
+ self.connection.privmsg(channel, segment)
+ except ValueError as err:
+ self.irker.debug(1, "irclib rejected a message to %s on %s because: %s" % (channel, self.servername, str(err)))
+ time.sleep(ANTI_FLOOD_DELAY)
self.last_xmit = self.channels_joined[channel] = time.time()
self.irker.debug(1, "XMIT_TTL bump (%s transmission) at %s" % (self.servername, time.asctime()))
self.queue.task_done()
<application>irkerd</application> sends messages to the the default 6667 IRC
port of each server.</para>
-<para>An empty message is legal and will cause
+<para>An empty message is legal and will cause
<application>irkerd</application> to join the target channels without
actually emitting a message. This may be useful for advertising that
-an instance is up and running.</para>
+an instance is up and running, or for joining a channel to log its
+traffic.</para>
</refsect1>
<refsect1 id='options'><title>OPTIONS</title>
<term>-l</term>
<listitem><para>Takes a following filename, logs traffic to that file.
Each log line consists of three |-separated fields; a numeric
-timestamp in Unix time, the fqdn of the sending server, and the
+timestamp in Unix time, the FQDN of the sending server, and the
message data.</para></listitem>
</varlistentry>
<varlistentry>