- 39920C295FDAF1BB2B6A76564DA9B8DC1770BA9FED4C145B72854432F302D919C9EA611485E0DE01EB544EBA1052471133C509AB8C4CC61C12E6C7EC83EA2B8D
+ 1FEA4F4A6A2C05324BA98DDF9615BED578E108A6E299A79A10EE5AD3748341F3DF42A4D68799CAD74655BE7AC8820669FC2BA15D72CC6EA6B325F345AD54393B
blatta/lib/client.py
(5 . 6)(5 . 8)
5 import string
6 import os
7 import base64
8 import traceback
9 from lib.message import Message
10 from lib.server import VERSION
11 from funcs import *
12 from lib.commands import BROADCAST
(150 . 7)(152 . 7)
14 self.disconnect("Client quit")
15 return
16 if self.nickname and self.user:
17 self.reply("001 %s :Hi, welcome to IRC" % self.nickname)
18 self.reply("001 %s :Hi, welcome to Pest" % self.nickname)
19 self.reply("002 %s :Your host is %s, running version blatta-%s"
20 % (self.nickname, server.name, VERSION))
21 self.reply("003 %s :This server was created sometime"
(341 . 13)(343 . 13)
23 self.channel_log(channel, message)
24 else:
25 formatted_message = ":%s %s %s :%s" % (self.prefix, command, targetname, message)
26 self.server.peer_message({
27 self.server.peer_message(Message({
28 "speaker": self.nickname,
29 "handle": targetname,
30 "body": formatted_message,
31 "bounces": 0,
32 "command": DIRECT
33 })
34 }, self.server))
35 if(client):
36 client.message(formatted_message)
37
(537 . 13)(539 . 18)
39 handle = arguments[0]
40 at = self.server.state.get_at(handle)
41 elif len(arguments) == 2:
42 handle, address = arguments
43 address_ip, port = string.split(address, ":")
44 self.server.state.update_address_table({"handle": handle,
45 "address": address_ip,
46 "port": port},
47 False)
48 self.pest_reply("updated address table: %s %s" % (handle, address))
49 try:
50 handle, address = arguments
51 address_ip, port = string.split(address, ":")
52 self.server.state.update_address_table({"handle": handle,
53 "address": address_ip,
54 "port": port},
55 False)
56 self.pest_reply("updated address table: %s %s" % (handle, address))
57 except Exception as ex:
58 self.pest_reply("Error attempting to update address table")
59 stack = traceback.format_exc()
60 print(stack)
61 return
62 elif len(arguments) > 2:
63 self.pest_reply("Usage: AT [<HANDLE>] [<ADDRESS>]")
(588 . 7)(595 . 9)
65 try:
66 handler_table[command]()
67 except KeyError:
68 self.reply("421 %s %s :Unknown command" % (self.nickname, command))
69 self.reply("421 %s %s :Unknown command" % (self.nickname, command))
70 stack = traceback.format_exc()
71 print(stack)
72
73 def socket_readable_notification(self):
74 try:
(647 . 12)(656 . 14)
76 if client != self or include_self:
77 client.message(line)
78 # send the channel message to peers as well
79 self.server.peer_message({
80 self.server.peer_message(
81 Message(
82 {
83 "speaker": self.nickname,
84 "command": BROADCAST,
85 "bounces": 0,
86 "body": line
87 })
88 }, self.server))
89
90 def channel_log(self, channel, message, meta=False):
91 if not self.server.logdir: