Mercurial > traipse_dev
comparison orpg/networking/mplay_messaging.py @ 119:9314d63c0941 alpha
Traipse Alpha 'OpenRPG' {091029-00}
Traipse is a distribution of OpenRPG that is designed to be easy to setup and go.
Traipse also makes it easy for developers to work on code without fear of
sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the
code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the
productivity of the user.
Update Summary:
Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images!
Changes made to the map for increased portability. SnowDog has changes planned in
Core, though.
Added an initial push to the BCG. Not much to see, just shows off how it is
re-writing Main code.
Fix to remote admin commands
Minor fix to texted based server, works in /System/ folder
Some Core changes to gametree to correctly disply Pretty Print, thanks David!
Fix to Splitter Nodes not being created.
Added images to Plugin Control panel for Autostart feature
Fix to massive amounts of images loading; from Core
fix to gsclient so with_statement imports
Added 'boot' command to remote admin
Prep work in Pass tool for remote admin rankings and different passwords, ei,
Server, Admin, Moderator, etc.
Remote Admin Commands more organized, more prep work.
Added Confirmation window for sent nodes.
Minor changes to allow for portability to an OpenSUSE linux OS (hopefully without
breaking)
{091028}
00:
Made changes to gametree to start working with Element Tree, mostly from Core
Minor changes to Map to start working with Element Tree, from Core
Preliminary changes to map efficiency, from FlexiRPG
Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG
Changes to main.py to start working with Element Tree
{091029}
00:
Changes made to server to start working with Element Tree.
Changes made to Meta Server Lib. Prepping test work for a multi meta network
page.
Minor bug fixed with mini to gametree
Zoom Mouse plugin added.
Known Issue: Disconnecting causes an server side error. XML data is not being
passed correctly.
author | sirebral |
---|---|
date | Thu, 29 Oct 2009 20:35:28 -0500 |
parents | 65c1604e7949 |
children | 06f10429eedc |
comparison
equal
deleted
inserted
replaced
118:217fb049bd00 | 119:9314d63c0941 |
---|---|
65 self.sendThreadExitEvent = Event() | 65 self.sendThreadExitEvent = Event() |
66 self.recvThreadExitEvent = Event() | 66 self.recvThreadExitEvent = Event() |
67 self.port = int(component.get("settings").get_setting("port")) ##used even? | 67 self.port = int(component.get("settings").get_setting("port")) ##used even? |
68 self.ip = socket.gethostbyname(socket.gethostname()) | 68 self.ip = socket.gethostbyname(socket.gethostname()) |
69 self.lensize = calcsize('i') | 69 self.lensize = calcsize('i') |
70 self.mplay_type = ('disconnected', 'connected', 'disconnecting', 'group change', 'group change failed') | 70 self.mplay_type = ('disconnected', 'connected', |
71 'disconnecting', 'group change', 'group change failed') | |
71 self.status = self.mplay_type[0] | 72 self.status = self.mplay_type[0] |
72 self.alive = False | 73 self.alive = False |
73 self.sock = None | 74 self.sock = None |
74 self.version = VERSION | 75 self.version = VERSION |
75 self.protocol_version = PROTOCOL_VERSION | 76 self.protocol_version = PROTOCOL_VERSION |
91 self.ignorelist = {} | 92 self.ignorelist = {} |
92 self.players = {} | 93 self.players = {} |
93 self.groups = {} | 94 self.groups = {} |
94 | 95 |
95 #Setup Stuff from the Server | 96 #Setup Stuff from the Server |
96 if kwargs.has_key('inbox'): | 97 """ |
97 self.inbox = kwargs['inbox'] | 98 if kwargs.has_key('inbox'): self.inbox = kwargs['inbox'] |
98 if kwargs.has_key('sock'): | 99 if kwargs.has_key('sock'): self.sock = kwargs['sock'] |
99 self.sock = kwargs['sock'] | 100 if kwargs.has_key('ip'): self.ip = kwargs['ip'] |
100 if kwargs.has_key('ip'): | 101 if kwargs.has_key('role'): self.role = kwargs['role'] |
101 self.ip = kwargs['ip'] | 102 if kwargs.has_key('id'): self.id = kwargs['id'] |
102 if kwargs.has_key('role'): | 103 if kwargs.has_key('group_id'): self.group_id = kwargs['group_id'] |
103 self.role = kwargs['role'] | 104 if kwargs.has_key('name'): self.name = kwargs['name'] |
104 if kwargs.has_key('id'): | 105 if kwargs.has_key('version'): self.version = kwargs['version'] |
105 self.id = kwargs['id'] | 106 if kwargs.has_key('protocol_version'): self.protocol_version = kwargs['protocol_version'] |
106 if kwargs.has_key('group_id'): | 107 if kwargs.has_key('client_string'): self.client_string = kwargs['client_string'] |
107 self.group_id = kwargs['group_id'] | 108 """ |
108 if kwargs.has_key('name'): | 109 |
109 self.name = kwargs['name'] | 110 ### Alpha ### |
110 if kwargs.has_key('version'): | 111 self.inbox = kwargs['inbox'] or pass |
111 self.version = kwargs['version'] | 112 self.sock = kwargs['sock'] or pass |
112 if kwargs.has_key('protocol_version'): | 113 self.ip = kwargs['ip'] or pass |
113 self.protocol_version = kwargs['protocol_version'] | 114 self.role = kwargs['role'] or pass |
114 if kwargs.has_key('client_string'): | 115 self.id = kwargs['id'] or pass |
115 self.client_string = kwargs['client_string'] | 116 self.group_id = kwargs['group_id'] or pass |
117 self.name = kwargs['name'] or pass | |
118 self.version = kwargs['version'] or pass | |
119 self.protocol_version = kwargs['protocol_version'] or pass | |
120 self.client_string = kwargs['client_string'] or pass | |
121 | |
116 | 122 |
117 def build_message(self, *args, **kwargs): | 123 def build_message(self, *args, **kwargs): |
118 #print args | 124 #print args |
119 message = '<' + args[0] | 125 message = '<' + args[0] |
120 | 126 |
157 def use_roles(self): | 163 def use_roles(self): |
158 return self.useroles | 164 return self.useroles |
159 | 165 |
160 def update_self_from_player(self, player): | 166 def update_self_from_player(self, player): |
161 try: | 167 try: |
162 (self.name, self.ip, self.id, self.text_status, self.version, self.protocol_version, self.client_string,role) = player | 168 (self.name, self.ip, self.id, self.text_status, |
169 self.version, self.protocol_version, self.client_string,role) = player | |
163 except: | 170 except: |
164 logger.general("Exception: messenger->update_self_from_player():\n" + traceback.format_exc()) | 171 logger.general("Exception: messenger->update_self_from_player():\n" + traceback.format_exc()) |
165 | 172 |
166 def toxml(self, act): | 173 def toxml(self, act): |
167 logger.exception("DEPRECIATED! messenger->toxml()") | 174 logger.exception("DEPRECIATED! messenger->toxml()") |
216 | 223 |
217 def idle_status(self): | 224 def idle_status(self): |
218 idletime = self.idle_time() | 225 idletime = self.idle_time() |
219 idlemins = idletime / 60 | 226 idlemins = idletime / 60 |
220 status = "Unknown" | 227 status = "Unknown" |
221 if idlemins < 3: | 228 if idlemins < 3: status = "Active" |
222 status = "Active" | 229 elif idlemins < 10: status = "Idle ("+str(int(idlemins))+" mins)" |
223 elif idlemins < 10: | 230 else: status = "Inactive ("+str(int(idlemins))+" mins)" |
224 status = "Idle ("+str(int(idlemins))+" mins)" | |
225 else: | |
226 status = "Inactive ("+str(int(idlemins))+" mins)" | |
227 return status | 231 return status |
228 | 232 |
229 def connected_time(self): | 233 def connected_time(self): |
230 curtime = time.time() | 234 curtime = time.time() |
231 timeoffset = curtime - self.connecttime | 235 timeoffset = curtime - self.connecttime |
243 | 247 |
244 def clear_timeout(self): | 248 def clear_timeout(self): |
245 self.timeout_time = None | 249 self.timeout_time = None |
246 | 250 |
247 def check_time_out(self): | 251 def check_time_out(self): |
248 if self.timeout_time==None: | 252 if self.timeout_time == None: self.timeout_time = time.time() |
249 self.timeout_time = time.time() | |
250 curtime = time.time() | 253 curtime = time.time() |
251 diff = curtime - self.timeout_time | 254 diff = curtime - self.timeout_time |
252 if diff > 1800: | 255 if diff > 1800: return 1 |
253 return 1 | 256 else: return 0 |
254 else: | |
255 return 0 | |
256 | 257 |
257 def send(self, msg): | 258 def send(self, msg): |
258 if self.get_status() == 'connected': | 259 if self.get_status() == 'connected': self.outbox.put(msg) |
259 self.outbox.put(msg) | |
260 | 260 |
261 def change_group(self, group_id, groups): | 261 def change_group(self, group_id, groups): |
262 old_group_id = str(self.group_id) | 262 old_group_id = str(self.group_id) |
263 groups[group_id].add_player(self.id) | 263 groups[group_id].add_player(self.id) |
264 groups[old_group_id].remove_player(self.id) | 264 groups[old_group_id].remove_player(self.id) |
273 self.text_status = xml_dom.getAttribute("status") | 273 self.text_status = xml_dom.getAttribute("status") |
274 | 274 |
275 def add_msg_handler(self, tag, function, core=False): | 275 def add_msg_handler(self, tag, function, core=False): |
276 if not self.msg_handlers.has_key(tag): | 276 if not self.msg_handlers.has_key(tag): |
277 self.msg_handlers[tag] = function | 277 self.msg_handlers[tag] = function |
278 if core: | 278 if core: self.core_msg_handlers.append(tag) |
279 self.core_msg_handlers.append(tag) | 279 else: print 'XML Messages ' + tag + ' already has a handler' |
280 else: | |
281 print 'XML Messages ' + tag + ' already has a handler' | |
282 | 280 |
283 def remove_msg_handler(self, tag): | 281 def remove_msg_handler(self, tag): |
284 if self.msg_handlers.has_key(tag) and not tag in self.core_msg_handlers: | 282 if self.msg_handlers.has_key(tag) and not tag in self.core_msg_handlers: |
285 del self.msg_handlers[tag] | 283 del self.msg_handlers[tag] |
286 else: | 284 else: print 'XML Messages ' + tag + ' already deleted' |
287 print 'XML Messages ' + tag + ' already deleted' | |
288 | |
289 | 285 |
290 #Message Handaling | 286 #Message Handaling |
291 def message_handler(self, arg): | 287 def message_handler(self, arg): |
292 xml_dom = None | 288 xml_dom = None |
293 logger.note("message handler thread running...", ORPG_NOTE) | 289 logger.note("message handler thread running...", ORPG_NOTE) |