Fixed so nick cmdline/channelname replacement worked with the new execute_cmd paradigm. Also, Resolves Issue 427.

This commit is contained in:
Griatch 2013-11-12 20:11:36 +01:00
parent 8f914196f4
commit d2448c3eb6
4 changed files with 23 additions and 8 deletions

View file

@ -49,7 +49,6 @@ class PortalSessionHandler(SessionHandler):
self.sessions[sessid] = session
# sync with server-side
if self.portal.amp_protocol: # this is a timing issue
print "syncing", sessdata
self.portal.amp_protocol.call_remote_ServerAdmin(sessid,
operation=PCONN,
data=sessdata)

View file

@ -184,6 +184,19 @@ class ServerSession(Session):
if text.strip() == IDLE_COMMAND:
self.update_session_counters(idle=True)
return
if self.player:
# nick replacement
nicks = self.player.db_attributes.filter(db_category__in=("nick_inputline", "nick_channel"))
puppet = self.player.get_puppet(self.sessid)
if puppet:
# merge, give prio to the lowest level (puppet)
nicks = list(puppet.db_attributes.filter(db_category__in=("nick_inputline", "nick_channel"))) + list(nicks)
raw_list = text.split(None)
raw_list = [" ".join(raw_list[:i+1]) for i in range(len(raw_list)) if raw_list[:i+1]]
for nick in nicks:
if nick.db_key in raw_list:
text = text.replace(nick.db_key, nick.db_strvalue, 1)
break
cmdhandler.cmdhandler(self, text, callertype="session", sessid=self.sessid)
self.update_session_counters()
if "oob" in kwargs: