def onClose(e): nwindows = list(windows.get_with(core.manager, network=e.window.network)) if isinstance(e.window, windows.ChannelWindow): cwindows = list( windows.get_with(core.manager, network=e.window.network, wclass=windows.ChannelWindow)) #if we only have one window for the network, don't bother to part as # we'll soon be quitting anyway if len(nwindows) != 1 and irc_script.ischan(e.window.network, e.window.id): e.window.network.part(e.window.id) if len(nwindows) == 1: core.events.trigger("CloseNetwork", window=e.window, network=e.window.network) elif isinstance(e.window, windows.StatusWindow) and conf.get('status'): core.events.trigger("CloseNetwork", window=e.window, network=e.window.network) for window in nwindows: if window != e.window: window.close() if len(core.manager) == 1: windows.new(windows.StatusWindow, irc.Network(), "status", core)
def onClose(e): nwindows = list(windows.get_with(network=e.window.network)) if isinstance(e.window, windows.ChannelWindow): cwindows = list(windows.get_with( network=e.window.network, wclass=windows.ChannelWindow )) #if we only have one window for the network, don't bother to part as # we'll soon be quitting anyway if len(nwindows) != 1 and irc_script.ischan(e.window.network, e.window.id): e.window.network.part(e.window.id) if len(nwindows) == 1: events.trigger("CloseNetwork", window=e.window, network=e.window.network) elif isinstance(e.window, windows.StatusWindow) and conf.get('status'): events.trigger("CloseNetwork", window=e.window, network=e.window.network) for window in nwindows: if window != e.window: window.close() if len(windows.manager) == 1: windows.new(windows.StatusWindow, irc.Network(), "status")
def channel_completer(window, left, right, text): if isinstance(window, windows.ChannelWindow): yield window.id for w in windows.get_with(wclass=windows.ChannelWindow, network=window.network): if w is not window: yield w.id for w in windows.get_with(wclass=windows.ChannelWindow): if w.network is not window.network: yield w.id
def channel_completer(window, left, right, text): if isinstance(window, windows.ChannelWindow): yield window.id for w in windows.get_with( wclass=windows.ChannelWindow, network=window.network): if w is not window: yield w.id for w in windows.get_with(wclass=windows.ChannelWindow): if w.network is not window.network: yield w.id
def setupNick(e): if e.source == e.network.me: for w in windows.get_with(core.manager, network=e.network): try: w.nick_label.update(e.target) except AttributeError: pass
def setdownPart(e): if e.source == e.network.me: window = windows.get(windows.ChannelWindow, e.network, e.target) if window: cwindows = list(windows.get_with( network=window.network, wclass=windows.ChannelWindow )) if len(cwindows) == 1 and not list(windows.get_with(network=window.network, wclass=windows.StatusWindow)): window.mutate(windows.StatusWindow, e.network, 'status') if e.requested: window.activate() elif e.requested: window.close()
def setupNick(e): if e.source == e.network.me: for w in windows.get_with(network=e.network): try: w.nick_label.update(e.target) except AttributeError: pass
def setdownPart(e): if e.source == e.network.me: window = windows.get(windows.ChannelWindow, e.network, e.target, core) if window: cwindows = list( windows.get_with(network=window.network, wclass=windows.ChannelWindow)) if len(cwindows) == 1 and not list( windows.get_with(network=window.network, wclass=windows.StatusWindow)): window.mutate(windows.StatusWindow, e.network, 'status') if e.requested: window.activate() elif e.requested: window.close()
def onDisconnect(e): to_write = '%s* Disconnected' % prefix(e) if e.error: to_write += ' (%s)' % e.error for window in windows.get_with(core.manager, network=e.network): if isinstance(window, windows.StatusWindow): window.write(to_write, widgets.TEXT) else: window.write(to_write, widgets.EVENT)
def onDisconnect(e): if e.error: to_write = '* Disconnected (%s)' % e.error else: to_write = '* Disconnected' for window in windows.get_with(network=e.network): f = log_file(e.network, window.id) f.write(to_write)
def onQuit(e): reps = { 'nick':e.source, 'address':e.address, 'text':e.text, 'timestamp':time.strftime(theme.get('TimeStamp',default.get('TimeStamp'))), 'pre':theme.get('Prefix',default.get('Prefix')) } for window in windows.get_with(network=e.network): if chaninfo.ison(e.network, window.id, e.source): output('Quit',None,window,reps,widgets.EVENT)
def onDisconnect(e): reps = { 'timestamp':time.strftime(theme.get('TimeStamp',default.get('TimeStamp'))), 'pre':theme.get('Prefix',default.get('Prefix')) } if hasattr(e,'error'): reps['text'] = e.error for window in windows.get_with(network=e.network): if isinstance(window, windows.StatusWindow): output('Disconnect',None,window,reps,widgets.TEXT) else: output('Disconnect',None,window,reps,widgets.EVENT)
def onNick(e): color = getsourcecolor(e) if e.source == e.network.me: to_write = "%s%sYou are now known as %s" % (prefix(e), color, e.target) else: to_write = "%s%s%s is now known as %s" % (prefix(e), color, e.source, e.target) if e.source == e.network.me: for window in windows.get_with(network=e.network): window.write(to_write) else: for channame in chaninfo.channels(e.network): if chaninfo.ison(e.network,channame,e.source): window = windows.get(windows.ChannelWindow, e.network, channame) if window: window.write(to_write)
def onNick(e): color = getsourcecolor(e) if e.source == e.network.me: to_write = "%s%sYou are now known as %s" % (prefix(e), color, e.target) else: to_write = "%s%s%s is now known as %s" % (prefix(e), color, e.source, e.target) if e.source == e.network.me: for window in windows.get_with(core.manager, network=e.network): window.write(to_write) else: for channame in chaninfo.channels(e.network): if chaninfo.ison(e.network, channame, e.source): window = windows.get(windows.ChannelWindow, e.network, channame) if window: window.write(to_write)
def onNick(e): if e.source == e.network.me: to_write = 'You are now known as %s' % e.target for window in windows.get_with(network=e.network): f = log_file(e.network, window.id) f.write(to_write) else: to_write = '%s is now known as %s' % (e.source, e.target) for channame in chaninfo.channels(e.network): if chaninfo.ison(e.network,channame,e.source): window = windows.get(windows.ChannelWindow, e.network, channame) if window: f = log_file(e.network, window.id) f.write(to_write)
def color_nicklists(network): for window in windows.get_with(network=network): if type(window).__name__ == 'ChannelWindow': color_nicklist(network,window)