Example #1
0
def hook_mode_cb(server, args):
    global op,mynick
    if '+o' not in args:
        return weechat.PLUGIN_RC_OK
    res = args.split(" ")
    weechat.prnt("Len args: %s" % len(res), '#tst', 'azzurra')
    weechat.prnt("Res: %s" % res, '#tst', 'azzurra')
    null, null, chan, mode, nick = args.split(" ", 5)
    weechat.prnt("nick: %s\nchan; %s" % (nick,chan), '#tst', 'azzurra')
    if (server in chans and chan in chans[server]):
        if nick == mynick:
            if not op and mode == '+o':
                op = True
                weechat.add_timer_handler(20, "hook_timer_cb") # 20sec di op
            elif mode == '-o':
                op = False
    return weechat.PLUGIN_RC_OK
Example #2
0
            # > log_filename, notify_level, server, num_displayed, type, channel
            if len(buffer['channel']):
                name = buffer['channel']
            elif len(buffer['server']):
                if cfg_boolean('show_servers'):
                    name = "[" + buffer['server'] + "]"
                else:
                    continue
            else:
                name = "?"
            names += ("%i:%s" % (index, name), )
    if (names != blist):
        the_string = " ".join(names)
        blist = names
        weechat.remove_infobar(-1)
        weechat.print_infobar(0, the_string);

def on_timer():
    update_channels()
    return weechat.PLUGIN_RC_OK

if weechat.register(NAME, VERSION, "cleanup", "bufferlist in infobar"):
    #message handlers are called __before__ buflist is changed, so we don't use them
    weechat.add_timer_handler(timer_interval, "on_timer")
    cfg_boolean('show_servers', False)
    update_channels()

# vim:set tabstop=4 softtabstop=4 shiftwidth=4:
# vim:set expandtab:

Example #3
0
# stampa la lista dei comandi disponibili
def hook_prihelp_cb(server, args):
    helps = ("/HELP addword",
             "/HELP delword",
             "/HELP addchan",
             "/HELP delchan",
             "/HELP pripar",
             "/HELP prichan",
             "/HELP pridata",
             "/HELP swkop")
    for i in helps:
        weechat.command(i)
    return weechat.PLUGIN_RC_OK_IGNORE_ALL

weechat.add_timer_handler(2, "hook_tmr_queue_cb")

weechat.add_message_handler("privmsg",
                            "hook_msg_cb")

weechat.add_message_handler("mode",
                            "hook_mode_cb")

weechat.add_command_handler("addword", "hook_addword_cb","",
                "bestemmia -:- commento : Aggiunge una nuova"
                " bestemmia alla lista")

weechat.add_command_handler("pripar", "hook_pripar_cb", "",
                ": stampa la lista delle parolacce monitorate")

weechat.add_command_handler("prichan", "hook_prichan_cb","",
Example #4
0
  weechat.prnt(" ")
  return weechat.PLUGIN_RC_OK


def no_hl_remove(serveur, args):
  """ allow a host to hl when he wants to """
  if args in people_not_allowed_to_hl:
    people_not_allowed_to_hl.remove(args)
  weechat.prnt(" ")
  weechat.prnt("\x02%s\x02 peut a nouveau highlighter" % args)
  weechat.prnt(" ")
  return weechat.PLUGIN_RC_OK


def vacuum():
  to_be_removed = []
  t = int(time())
  for k,v in timer_dict.iteritems():
    if v < t:
      to_be_removed.append(k)
  for key in to_be_removed:
    del timer_dict[key]
  return weechat.PLUGIN_RC_OK


weechat.add_modifier("irc_in", "PRIVMSG", "highlight_checker")
weechat.add_command_handler("no_hl_add", "no_hl_add")
weechat.add_command_handler("no_hl_remove", "no_hl_remove")
weechat.add_command_handler("no_hl_list", "no_hl_list")
weechat.add_timer_handler(VACUUM_DELAY, 'vacuum')