weechat

- me personal weechat setup 🔵🟢
git clone git://git.acid.vegas/weechat.git
Log | Files | Refs | Archive | README

masshl.py (1252B)

      1 # -*- coding: utf-8 -*-
      2 # masshl script for weechat - developed by acidvegas (https://git.acid.vegas/weechat)
      3 
      4 import weechat
      5 
      6 nicks = list()
      7 
      8 def timer_cb(data, remaining_calls):
      9 	try:
     10 		chan = data.split('[split]')[0]
     11 		msg  = data.split('[split]')[1]
     12 		if '%n' in msg:
     13 			while '%n' in msg:
     14 				msg = msg.replace('%n', nicks[0], 1)
     15 				nicks.pop(0)
     16 			weechat.command(chan, msg)
     17 	except:
     18 		pass
     19 	finally:
     20 		return weechat.WEECHAT_RC_OK
     21 
     22 def masshl_cmd_cb(data, buffer, args):
     23 	server   = weechat.buffer_get_string(buffer, 'localvar_server')
     24 	channel  = weechat.buffer_get_string(buffer, 'localvar_channel')
     25 	nicklist = weechat.infolist_get('irc_nick', '', server+','+channel)
     26 	while weechat.infolist_next(nicklist):
     27 		nicks.append(weechat.infolist_string(nicklist, 'name'))
     28 	weechat.infolist_free(nicklist)
     29 	del server, channel, nicklist
     30 	nicks.pop(0)
     31 	if args[:2] == '-1':
     32 		weechat.command(buffer, ', '.join(nicks))
     33 	else:
     34 		weechat.hook_timer(100, 0, len(nicks), 'timer_cb', '[split]'.join((buffer,args)))
     35 	return weechat.WEECHAT_RC_OK
     36 
     37 if weechat.register('masshl', 'acidvegas', '1.0', 'ISC', 'mass hilight all nicks in a channel', '', ''):
     38 	weechat.hook_command('masshl', 'mass hilight all nicks in a channel', '', '', '', 'masshl_cmd_cb', '')