def send(msg, server, witem): prefix = irssi.settings_get_str("prefix") targets = irssi.settings_get_str("prefix_targets") cmdchars = irssi.settings_get_str("cmdchars") if re.match("^([%s]|%s)" % (cmdchars, prefix), msg): return if not check_target(witem.name, targets): return signal = irssi.signal_get_emitted() msg = "%s%s" % (prefix, msg) irssi.signal_stop() irssi.signal_emit(signal, msg, server, witem)
def sig_beep(): global might_beep beep_cmd = irssi.settings_get_str('beep_cmd') if not beep_cmd: return beep_flood = irssi.settings_get_int('beep_flood') if beep_flood <= 0: beep_flood = 1000 if might_beep: os.system(beep_cmd) might_beep = False irssi.timeout_add(beep_flood, beep_overflow_timeout) irssi.signal_stop()
def load_settings(self, *args): nikeys = ["default_channels", "default_queries"] setkeys = ["override_notify", "override_ignore"] keys = nikeys + setkeys + ["socket"] settings = {} for key in keys: settings[key] = irssi.settings_get_str(key) for key in setkeys: settings[key] = set([i.lower() for i in settings[key].split()]) for key in nikeys: if settings[key] not in ["notify", "ignore"]: irssi.prnt("RStatus: Warning: option " + key + " is invalid") settings[key] = (settings[key] == "notify") settings["socket"] = os.path.expanduser(settings["socket"]) self.settings = settings