def _on_join(conn, event): channel = event.target remote_addr = socket.gethostbyaddr(conn.socket.getpeername()[0])[0] my_data = utils.get_entry(remote_addr, settings) target_nick = utils.get_irc_username(event.source) if my_data["nick"] == target_nick: # I joined channel for server, data in settings.items(): if utils.get_domain(remote_addr) == utils.get_domain(server): communicator( "add_item", { 'channel': channel, 'server': server, 'type': 'irc' } ) break else: # someone else joined channel communicator( "recv_msg", { "target": channel, "sender": channel, "msg": '%s joined' % target_nick } )
def send_privmsg(msg, info): channel = info['channel'] server = info['server'] for serv, data in servers.items(): if utils.get_domain(server) == utils.get_domain(serv): servers[server]["conn"].privmsg(channel, msg) break
def _on_welcome(conn, event): for server, data in settings.items(): if utils.get_domain(event.source) == utils.get_domain(server): for chan in data['channels']: join_channel(chan, server)