Skip to content

Instantly share code, notes, and snippets.

@myano
Last active December 14, 2015 03:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myano/5021607 to your computer and use it in GitHub Desktop.
Save myano/5021607 to your computer and use it in GitHub Desktop.
If you have saved your buffers in WeeChat with "/layout save", this script will print out an easy to copy/paste "/join #channel1,#channel2" that you can paste into WeeChat to join channels. If you have a lot of channels (more than 100). I would recommend joining only about 75-100 channels at a time.
#!/usr/bin/env python
import copy
f = open('weechat.conf', 'r')
formats = ['/join ', '/query ']
networks = {
'freenode': copy.copy(formats),
'oftc': copy.copy(formats),
'efnet': copy.copy(formats),
}
for line in f:
for network in networks.keys():
if 'buffer = "irc;' + network in line:
l = line.split(';')
g = l[1].split('.', 1)
channel = ''.join(g[1:])
if channel.startswith('#'):
networks[network][0] += channel + ','
else:
nick = channel
networks[network][1] += nick + '; '
f.close()
for x in networks:
print x
for y in networks[x]:
print '\t', y
print ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment