def msgFromWords(self, toNick, sender, message, metadata=None): """Deliver a directMessage as a privmsg over IRC. """ if message[0] != irc.X_DELIM: if metadata and metadata.has_key('style'): # Damn. What am I supposed to do with this? message = "[%s] %s" % (metadata['style'], message) self.irc.msg(toNick, '<%s> %s' % (sender, message)) else: # If there is a CTCP delimeter at the beginning of the # message, let's leave it there to accomidate not-so- # tolerant clients. dcc_data = None if message[1:5] == 'DCC ': dcc_query = irc.ctcpExtract(message)['extended'][0] dcc_data = dcc_query[1] if dcc_data: desc = "DCC " + irc.dccDescribe(dcc_data) else: desc = "CTCP request" self.irc.msg(toNick, 'The following %s is from %s' % (desc, sender)) self.irc.msg(toNick, '%s' % (message,))
def ctcpQuery_DCC(self, user, channel, data): """Accept DCC handshakes, for passing on to others. """ nick = string.split(user, "!")[0] # We're pretty lenient about what we pass on, but the existance # of at least four parameters (type, arg, host, port) is really # required. if len(string.split(data)) < 4: self.ctcpMakeReply( nick, [('ERRMSG', 'DCC %s :Malformed DCC request.' % (data))]) return dcc_text = irc.dccDescribe(data) self.notice(nick, "Got your DCC %s" % (irc.dccDescribe(data), )) pName = self._getParticipant(nick).name self.dcc_sessions[pName] = (user, dcc_text, data) self.notice( nick, "If I should pass it on to another user, " "/msg %s DCC PASSTO theirNick" % (self.nickname, ))
def ctcpQuery_DCC(self, user, channel, data): """Accept DCC handshakes, for passing on to others. """ nick = string.split(user,"!")[0] # We're pretty lenient about what we pass on, but the existance # of at least four parameters (type, arg, host, port) is really # required. if len(string.split(data)) < 4: self.ctcpMakeReply(nick, [('ERRMSG', 'DCC %s :Malformed DCC request.' % (data))]) return dcc_text = irc.dccDescribe(data) self.notice(nick, "Got your DCC %s" % (irc.dccDescribe(data),)) pName = self._getParticipant(nick).name self.dcc_sessions[pName] = (user, dcc_text, data) self.notice(nick, "If I should pass it on to another user, " "/msg %s DCC PASSTO theirNick" % (self.nickname,))
def msgFromWords(self, toNick, sender, message): """Deliver a directMessage as a privmsg over IRC. """ if message[0] != irc.X_DELIM: self.msg(toNick, '<%s> %s' % (sender, message)) else: # If there is a CTCP delimeter at the beginning of the # message, let's leave it there to accomidate not-so- # tolerant clients. dcc_data = None if message[1:5] == 'DCC ': dcc_query = irc.ctcpExtract(message)['extended'][0] dcc_data = dcc_query[1] if dcc_data: desc = "DCC " + irc.dccDescribe(dcc_data) else: desc = "CTCP request" self.msg(toNick, 'The following %s is from %s' % (desc, sender)) self.msg(toNick, '%s' % (message, ))