Ejemplo n.º 1
0
def prefs(job, args=None):
    """Saves|Gets preferences."""
    if job == 'get':
        status = xchat.get_pluginpref("shorten_status")

        # Get data from database
        if not status: return True
        else:
            if status == 'on': return True
            else: return False
    if job == 'put' and args:
        xchat.set_pluginpref("shorten_status", args)
        xchat.prnt("Preferences saved.")
Ejemplo n.º 2
0
def setcolor_cb(word, word_eol, userdata):
    global users
    try:
        users[word[1].lower()] = int(word[2])
    except (IndexError, ValueError):
        print("/setcolor <nick> <number>")
        return xchat.EAT_XCHAT
    print("*\tColor has been set for \003{:02}{}".format(
        users[word[1].lower()], word[1]))
    if not xchat.set_pluginpref(
            setting_prefix + word[1].lower(),  #Name
            int(word[2]),  #Color
    ):
        print("SpecifyColor: Setting could not be saved!")
    return xchat.EAT_XCHAT
Ejemplo n.º 3
0
def decipher_youtube_url(url, nick, orig_msg, dest=None):
	try:
		for line in urlopen(url):
			line = line.decode('utf-8')
			if line.startswith("<title>"):
				title = unescape(re.sub(r"^<title>(.*) - YouTube</title>.*",r"\1",line))
				msg = format_msg(nick,url,title)
				sending_msg = xchat.get_pluginpref(SENDING_MSG_PREF)
				not sending_msg and xchat.set_pluginpref(SENDING_MSG_PREF,"no") 
				DEBUG and xchat.prnt(__module_name__+": "+SENDING_MSG_PREF+": "+sending_msg)
				if sending_msg != None and dest != None and sending_msg == "yes" and not msg_containing_word_of_title(orig_msg,title):
					DEBUG and xchat.prnt(__module_name__+": sending msg")
					xchat.command("msg "+dest+" "+ msg)
				else:
					xchat.prnt(msg)
	except BaseException as e:
		xchat.prnt(__module_name__+" failed to decipher : "+url+" error: "+e.__str__())
Ejemplo n.º 4
0
def save_pref():
    """Saves preferences."""
    xchat.set_pluginpref("autoreplace_re_pattern", str(re_pattern))
    xchat.set_pluginpref("autoreplace_re_repl", str(re_repl))
    xchat.prnt("Preferences saved.")
Ejemplo n.º 5
0
def save_pref():
    """Saves preferences."""
    xchat.set_pluginpref("autoreplace_re_pattern", str(re_pattern))
    xchat.set_pluginpref("autoreplace_re_repl", str(re_repl))
    xchat.prnt("Preferences saved.")