Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate

Commit c23b8e96dbe48481b6c37c7718a5303ffa114bd8

Adding sugar-es channel, matching aslo release
NEWS
(6 / 0)
  
19
2*Adding sugar-es tab
3*Adding i18n
4*Fixing activity.info (adding bundle_id)
5
6
17Version 8 (2010-11-19)
28* Fixed inability to talk in restored channels (#2493)
39
TODO
(1 / 0)
  
44* Pop up last active channel when loading from journal
55* Direct the user to localized channels other than #sugar
66* Multi-server support, maybe?
7* Recognize locale to add other channel #sugar-lang
  
11[Activity]
22name = IRC
3activity_version = 8
4service_name = org.sugarlabs.IRC
3activity_version = 9
4bundle_id = org.sugarlabs.IRC-multilingua
55icon = activity-ircchat
66exec = sugar-activity ircactivity.IRCActivity
  
2929import purk.conf
3030import purk.windows
3131
32
3233class IRCActivity(activity.Activity):
3334
3435 def __init__(self, handle):
6464 self.show_all()
6565
6666 def __visibility_notify_event_cb(self, window, event):
67 self.is_visible = event.state != gtk.gdk.VISIBILITY_FULLY_OBSCURED
68
67 self.is_visible = event.state != gtk.gdk.VISIBILITY_FULLY_OBSCURED
68
69 #Configuracion por defecto
70
6971 def default_config(self):
7072 self.client.join_server('us.freenode.net')
7173 self.client.add_channel('#sugar')
74 self.client.add_channel_other('#sugar-es')
7275
7376 def read_file(self, file_path):
7477 if self.metadata['mime_type'] != 'text/plain':
8787 self.client.join_server(data['server'])
8888 for chan in data['channels']:
8989 self.client.add_channel(chan)
90
90 self.client.add_channel_other(chan)
9191 self.client.core.window.network.requested_joins = set()
9292 for winid in data['scrollback'].keys():
9393 if winid in data['channels']:
purk/ABOUT
(1 / 1)
  
1Urk is a PyGTK IRC Client written by Vincent Povirk and Marc Liddell.
1Urk [http://urk.sourceforge.net/] is a PyGTK IRC Client written by Vincent Povirk and Marc Liddell.
22This current version has been modified in order to have an PyGTK
33IRC Client Widget called 'PUrk'.
44
  
8484 def run_command(self, command):
8585 self.core.run_command(command)
8686
87 def join_server(self, network_name, port=6667):
87 def join_server(self, network_name, port=8001):
8888 command = 'server '+ network_name + ' ' + str(port)
8989 self.run_command(command)
9090
9898 print "** DEBUG :: Add default channel: ", channel
9999 self.core.channels.append(channel)
100100
101 def add_channel_other(self, channelother):
102 print "** DEBUG :: Add default channel other: ", channelother
103 self.core.channels.append(channelother)
104
105
101106 def clear_channels(self):
102107 self.core.channels = []
purk/irc.py
(30 / 19)
  
1111INITIALIZING = 2
1212CONNECTED = 3
1313
14
1415def parse_irc(msg, server):
1516 msg = msg.split(' ')
1617
4040 # note: this sucks and makes very little sense, but it matches the BNF
4141 # as far as we've tested, which seems to be the goal
4242
43
4344def default_nicks():
4445 try:
45 nicks = [conf.get('nick')] + conf.get('altnicks',[])
46 nicks = [conf.get('nick')] + conf.get('altnicks', [])
4647 if not nicks[0]:
4748
4849 # We're going to generate a nick based on the user's nick name
6464 # if it's more than 11 characters (as we need 5 for - and the
6565 # hash).
6666 if len(user_name_letters) == 0:
67 user_name_letters = "XO"
67 user_name_letters = "XO"
6868 if len(user_name_letters) > 11:
69 user_name_letters = user_name_letters[0:11]
69 user_name_letters = user_name_letters[0:11]
7070
7171 # Finally, generate a nick by using those letters plus the first
7272 # four hash bits of the user's public key.
7777 nicks = ["purk"]
7878 return nicks
7979
80
8081class Network(object):
8182 socket = None
8283
83 def __init__(self, core, server="irc.default.org", port=6667, nicks=[],
84 def __init__(self, core, server="irc.default.org", port=8001, nicks=[],
8485 username="", fullname="", name=None, **kwargs):
8586 self.core = core
8687 self.manager = core.manager
103103 'PREFIX': '(ohv)@%+',
104104 'CHANMODES': 'b,k,l,imnpstr',
105105 }
106 self.prefixes = {'o':'@', 'h':'%', 'v':'+', '@':'o', '%':'h', '+':'v'}
106 self.prefixes = {'o': '@', 'h': '%', 'v': '+', '@': 'o', '%': 'h', '+': 'v'}
107107
108108 self.status = DISCONNECTED
109 self.failedhosts = [] #hosts we've tried and failed to connect to
109 self.failedhosts = [] # hosts we've tried and failed to connect to
110110 self.channel_prefixes = '&#+$' # from rfc2812
111111
112112 self.on_channels = set()
124124 #import random
125125 #random.seed()
126126 #random.shuffle(result)
127 if socket.has_ipv6: #prefer ipv6
128 result = [(f, t, p, c, a) for (f, t, p, c, a) in result if f == socket.AF_INET6]+result
129 elif hasattr(socket,"AF_INET6"): #ignore ipv6
127 if socket.has_ipv6: # prefer ipv6
128 result = [(f, t, p, c, a) for (f, t, p, c, a) in result if f == socket.AF_INET6] + result
129 elif hasattr(socket, "AF_INET6"): # ignore ipv6
130130 result = [(f, t, p, c, a) for (f, t, p, c, a) in result if f != socket.AF_INET6]
131131
132132 self.failedlasthost = False
176176 # Auto join channels on connect
177177 for channel in self.core.channels:
178178 self.core.run_command("/join %s" % channel)
179
179 for channelother in self.core.channels:
180 self.core.run_command("/join %s" % channelother)
181
180182 #called when we read data or failed to read data
183
181184 def on_read(self, result, error):
182185 if error:
183186 self.disconnect(error=error[1])
220220 )
221221
222222 if "!" in pmsg[0]:
223 e_data.source, e_data.address = pmsg[0].split('!',1)
223 e_data.source, e_data.address = pmsg[0].split('!', 1)
224224
225225 else:
226226 e_data.source, e_data.address = pmsg[0], ''
280280
281281 def join(self, target, key='', requested=True):
282282 if key:
283 key = ' '+key
284 self.raw("JOIN %s%s" % (target,key))
283 key = ' ' + key
284 self.raw("JOIN %s%s" % (target, key))
285285 if requested:
286 for chan in target.split(' ',1)[0].split(','):
286 for chan in target.split(' ', 1)[0].split(','):
287287 if chan == '0':
288288 self.requested_parts.update(self.on_channels)
289289 else:
295295
296296 self.raw("PART %s%s" % (target, msg))
297297 if requested:
298 for chan in target.split(' ',1)[0].split(','):
298 for chan in target.split(' ', 1)[0].split(','):
299299 self.requested_parts.add(self.norm_case(target))
300300
301301 def msg(self, target, msg):
302302 self.raw("PRIVMSG %s :%s" % (target, msg))
303
304
303
305304 if len(msg) > 8 and msg[0:7] == "\x01ACTION":
306305 self.events.trigger(
307306 'OwnAction', source=self.me, target=str(target),
335335 )
336336
337337#a Network that is never connected
338
339
338340class DummyNetwork(Network):
341
339342 def __nonzero__(self):
340343 return False
341344
351351 raise NotImplementedError, "Cannot connect dummy network."
352352
353353 def raw(self, msg):
354 raise NotImplementedError, "Cannot send %s over the dummy network." % repr(msg)
354 raise NotImplementedError, "Cannot send %s over the dummfy network." % repr(msg)
355355
356356#dummy_network = DummyNetwork()
357357
358358#this was ported from srvx's tools.c
359
360
359361def match_glob(text, glob, t=0, g=0):
362
360363 while g < len(glob):
361364 if glob[g] in '?*':
362365 star_p = q_cnt = 0
378378 if g == len(glob):
379379 return True
380380 for i in xrange(t, len(text)):
381 if text[i] == glob[g] and match_glob(text, glob, i+1, g+1):
381 if text[i] == glob[g] and match_glob(text, glob, i + 1, g + 1):
382382 return True
383383 return False
384384 else:
  
88 print "** DEBUG :: Add Window: ", window
99 manager.add(window)
1010
11def append(window1, manager):
12 print "** DEBUG :: Add window1: ", window1
13 manager.add(window1)
14
1115def remove(window, manager):
1216 print "** DEBUG :: Remove Window: ", window
1317 manager.remove(window)
300300 self.show_all()
301301
302302 def is_channel(self):
303 return True
304
305 def is_channel_other(self):
303306 return True