message sending bug fixes + sortilege update
- sortilege now use default profile. /!\ sortilege is really buggy currently, need some attention
This commit is contained in:
parent
ca242c7aee
commit
9fd444d937
2 changed files with 31 additions and 27 deletions
|
|
@ -48,7 +48,7 @@ class Chat(Window, QuickChat):
|
|||
Window.__init__(self, self.__parent, self.__parent.getmaxyx()[0]-2, self.__parent.getmaxyx()[1]-30, 0,30, code=host.code)
|
||||
|
||||
#history
|
||||
self.historyPrint(50, True)
|
||||
self.historyPrint(50, True, profile=self.host.profile)
|
||||
|
||||
self.hide()
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ class Chat(Window, QuickChat):
|
|||
if self.host.chatParams["timestamp"]:
|
||||
header = header + '[%s] ' % strftime("%H:%M", localtime(float(line[0])))
|
||||
if self.host.chatParams['short_nick']:
|
||||
header = header + ('> ' if line[1]==self.host.whoami.short else '** ')
|
||||
header = header + ('> ' if line[1]==self.host.profiles[self.host.profile]['whoami'] else '** ')
|
||||
else:
|
||||
header = header + '<%s> ' % line[1]
|
||||
return header
|
||||
|
|
@ -85,7 +85,7 @@ class Chat(Window, QuickChat):
|
|||
header=self.__getHeader(self.content[idx])
|
||||
msg=self.content[idx][2]
|
||||
part=0 #part of the text
|
||||
if JID(self.content[idx][1]).short==self.host.whoami.short:
|
||||
if JID(self.content[idx][1]).short==self.host.profiles[self.host.profile]['whoami'].short:
|
||||
att_header=curses.color_pair(1)
|
||||
else:
|
||||
att_header=curses.color_pair(2)
|
||||
|
|
@ -137,7 +137,7 @@ class Chat(Window, QuickChat):
|
|||
self.__scollIdx = self.__scollIdx - 1
|
||||
self.update()
|
||||
|
||||
def printMessage(self, jid, msg, timestamp=""):
|
||||
def printMessage(self, jid, msg, profile, timestamp=""):
|
||||
if timestamp=="":
|
||||
current_time=time()
|
||||
timestamp=str(current_time)
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@ class SortilegeApp(QuickApp):
|
|||
self.chat_wins=ChatList(self)
|
||||
|
||||
QuickApp.__init__(self) #XXX: yes it's an unusual place for the constructor of a parent class, but the init order is important
|
||||
self.plug_profile()
|
||||
|
||||
signal (SIGWINCH, self.onResize) #we manage SIGWINCH ourselves, because the loop is not called otherwise
|
||||
|
||||
|
|
@ -271,8 +272,8 @@ class SortilegeApp(QuickApp):
|
|||
|
||||
|
||||
def onTextEntered(self, text):
|
||||
jid=JID(self.whoami)
|
||||
self.bridge.sendMessage(self.currentChat, text)
|
||||
jid=JID(self.profiles[self.profile]['whoami'])
|
||||
self.bridge.sendMessage(self.currentChat, text, profile_key=self.profile)
|
||||
|
||||
def showDialog(self, message, title, type="info"):
|
||||
if type==question:
|
||||
|
|
@ -280,8 +281,8 @@ class SortilegeApp(QuickApp):
|
|||
pass
|
||||
|
||||
|
||||
def presenceUpdate(self, jabber_id, show, priority, statuses):
|
||||
QuickApp.presenceUpdate(self, jabber_id, show, priority, statuses)
|
||||
def presenceUpdate(self, jabber_id, show, priority, statuses, profile):
|
||||
QuickApp.presenceUpdate(self, jabber_id, show, priority, statuses, profile)
|
||||
self.editBar.replace_cur()
|
||||
curses.doupdate()
|
||||
|
||||
|
|
@ -293,8 +294,8 @@ class SortilegeApp(QuickApp):
|
|||
#FIXME
|
||||
info ("FIXME: actionResult not implemented")
|
||||
|
||||
def newMessage(self, from_jid, msg, type, to_jid):
|
||||
QuickApp.newMessage(self, from_jid, msg, type, to_jid)
|
||||
def newMessage(self, from_jid, msg, type, to_jid, profile):
|
||||
QuickApp.newMessage(self, from_jid, msg, type, to_jid, profile)
|
||||
sender=JID(from_jid)
|
||||
addr=JID(to_jid)
|
||||
win = addr if sender.short == self.whoami.short else sender #FIXME: duplicate code with QuickApp
|
||||
|
|
|
|||
Loading…
Reference in a new issue