Mercurial > libervia-backend
comparison frontends/sortilege/chat.py @ 67:0e50dd3a234a
message sending bug fixes + sortilege update
- sortilege now use default profile. /!\ sortilege is really buggy currently, need some attention
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 04 Feb 2010 01:06:36 +1100 |
parents | a5b5fb5fc9fd |
children | 8f2ed279784b |
comparison
equal
deleted
inserted
replaced
66:8147b4f40809 | 67:0e50dd3a234a |
---|---|
46 self.content=[] | 46 self.content=[] |
47 self.__scollIdx=0 | 47 self.__scollIdx=0 |
48 Window.__init__(self, self.__parent, self.__parent.getmaxyx()[0]-2, self.__parent.getmaxyx()[1]-30, 0,30, code=host.code) | 48 Window.__init__(self, self.__parent, self.__parent.getmaxyx()[0]-2, self.__parent.getmaxyx()[1]-30, 0,30, code=host.code) |
49 | 49 |
50 #history | 50 #history |
51 self.historyPrint(50, True) | 51 self.historyPrint(50, True, profile=self.host.profile) |
52 | 52 |
53 self.hide() | 53 self.hide() |
54 | 54 |
55 def resize(self, height, width, y, x): | 55 def resize(self, height, width, y, x): |
56 Window.resize(self, height, width, y, x) | 56 Window.resize(self, height, width, y, x) |
66 """Return the header of a line (eg: "[12:34] <toto> ").""" | 66 """Return the header of a line (eg: "[12:34] <toto> ").""" |
67 header='' | 67 header='' |
68 if self.host.chatParams["timestamp"]: | 68 if self.host.chatParams["timestamp"]: |
69 header = header + '[%s] ' % strftime("%H:%M", localtime(float(line[0]))) | 69 header = header + '[%s] ' % strftime("%H:%M", localtime(float(line[0]))) |
70 if self.host.chatParams['short_nick']: | 70 if self.host.chatParams['short_nick']: |
71 header = header + ('> ' if line[1]==self.host.whoami.short else '** ') | 71 header = header + ('> ' if line[1]==self.host.profiles[self.host.profile]['whoami'] else '** ') |
72 else: | 72 else: |
73 header = header + '<%s> ' % line[1] | 73 header = header + '<%s> ' % line[1] |
74 return header | 74 return header |
75 | 75 |
76 def update(self): | 76 def update(self): |
83 irange.reverse() #we print the text upward | 83 irange.reverse() #we print the text upward |
84 for idx in irange: | 84 for idx in irange: |
85 header=self.__getHeader(self.content[idx]) | 85 header=self.__getHeader(self.content[idx]) |
86 msg=self.content[idx][2] | 86 msg=self.content[idx][2] |
87 part=0 #part of the text | 87 part=0 #part of the text |
88 if JID(self.content[idx][1]).short==self.host.whoami.short: | 88 if JID(self.content[idx][1]).short==self.host.profiles[self.host.profile]['whoami'].short: |
89 att_header=curses.color_pair(1) | 89 att_header=curses.color_pair(1) |
90 else: | 90 else: |
91 att_header=curses.color_pair(2) | 91 att_header=curses.color_pair(2) |
92 | 92 |
93 while (msg): | 93 while (msg): |
135 """decrement scroll index""" | 135 """decrement scroll index""" |
136 if self.__scollIdx > 0: | 136 if self.__scollIdx > 0: |
137 self.__scollIdx = self.__scollIdx - 1 | 137 self.__scollIdx = self.__scollIdx - 1 |
138 self.update() | 138 self.update() |
139 | 139 |
140 def printMessage(self, jid, msg, timestamp=""): | 140 def printMessage(self, jid, msg, profile, timestamp=""): |
141 if timestamp=="": | 141 if timestamp=="": |
142 current_time=time() | 142 current_time=time() |
143 timestamp=str(current_time) | 143 timestamp=str(current_time) |
144 if self.last_history and current_time - float(self.last_history) < 5: #FIXME: Q&D fix to avoid double print on new chat window | 144 if self.last_history and current_time - float(self.last_history) < 5: #FIXME: Q&D fix to avoid double print on new chat window |
145 return | 145 return |