do not remember lines for transports

This commit is contained in:
Nikos Kouremenos 2005-05-30 21:12:34 +00:00
parent b34b3c8e55
commit 968762437f
3 changed files with 57 additions and 50 deletions

View File

@ -236,7 +236,6 @@ class Chat:
try:
gtkspell.Spell(message_textview)
except gobject.GError, msg:
print msg
dialogs.Error_dialog(str(msg) + '\n\n' + _('If that is not your language for which you want to highlight misspelled words, then please set your $LANG as appropriate. Eg. for French do export LANG=fr_FR or export LANG=fr_FR.UTF-8 in ~/.bash_profile or to make it global in /etc/profile.\n\nHighlighting misspelled words will not be used'))
gajim.config.set('use_speller', False)
@ -718,45 +717,3 @@ class Chat:
self.plugin.systray.add_jid(jid, self.account)
self.redraw_tab(jid)
self.show_title()
def restore_conversation(self, jid):
#How many lines to restore
restore = gajim.config.get('restore_lines')
pos = 0 #position, while reading from history
size = 0 #how many lines we alreay retreived
lines = [] #we'll need to reverse the lines from history
count = gajim.logger.get_nb_line(jid)
while size <= restore:
if pos == count or size > restore - 1:
#don't try to read beyond history, not read more than required
break
nb, line = gajim.logger.read(jid, count - 1 - pos, count - pos)
pos = pos + 1
if line[0][1] != 'sent' and line[0][1] != 'recv':
# we don't want to display status lines, do we?
continue
lines.append(line[0])
size = size + 1
lines.reverse()
for msg in lines:
if msg[1] == 'sent':
kind = 'outgoing'
name = self.plugin.nicks[self.account]
elif msg[1] == 'recv':
kind = 'incoming'
# self.users is not initialized here yet
name = self.plugin.roster.contacts[self.account][jid][0].name
tim = time.gmtime(float(msg[0]))
if msg[2][-1] == '\n':
text = msg[2][:-1]
else:
text = msg[2]
self.print_conversation_line(text, jid, kind, name, tim)

View File

@ -189,19 +189,19 @@ class Roster_window:
host = jid.split('@')[-1]
if host.find('aim.') == 0:
if host.startswith('aim.'):
state_images = self.transports_state_images['aim']
elif host.find('gadugadu.') == 0:
elif host.startswith('gadugadu.'):
state_images = self.transports_state_images['gadugadu']
elif host.find('irc.') == 0:
elif host.startswith('irc.'):
state_images = self.transports_state_images['irc']
elif host.find('icq.') == 0:
elif host.startswith('icq.'):
state_images = self.transports_state_images['icq']
elif host.find('msn.') == 0:
elif host.startswith('msn.'):
state_images = self.transports_state_images['msn']
elif host.find('sms.') == 0:
elif host.startswith('sms.'):
state_images = self.transports_state_images['sms']
elif host.find('yahoo.') == 0:
elif host.startswith('yahoo.'):
state_images = self.transports_state_images['yahoo']
else:
state_images = self.jabber_state_images

View File

@ -298,3 +298,53 @@ class Tabbed_chat_window(chat.Chat):
name = user.name
chat.Chat.print_conversation_line(self, text, jid, kind, name, tim)
def restore_conversation(self, jid):
is_transport = bool(
jid.startswith('aim.') or jid.startswith('gadugadu.') or\
jid.startswith('irc.') or jid.startswith('icq.') or\
jid.startswith('msn.') or jid.startswith('sms.') or\
jid.startswith('yahoo.')
)
if is_transport:
return
#How many lines to restore
restore = gajim.config.get('restore_lines')
pos = 0 #position, while reading from history
size = 0 #how many lines we alreay retreived
lines = [] #we'll need to reverse the lines from history
count = gajim.logger.get_nb_line(jid)
while size <= restore:
if pos == count or size > restore - 1:
#don't try to read beyond history, not read more than required
break
nb, line = gajim.logger.read(jid, count - 1 - pos, count - pos)
pos = pos + 1
if line[0][1] != 'sent' and line[0][1] != 'recv':
# we don't want to display status lines, do we?
continue
lines.append(line[0])
size = size + 1
lines.reverse()
for msg in lines:
if msg[1] == 'sent':
kind = 'outgoing'
name = self.plugin.nicks[self.account]
elif msg[1] == 'recv':
kind = 'incoming'
# self.users is not initialized here yet
name = self.plugin.roster.contacts[self.account][jid][0].name
tim = time.gmtime(float(msg[0]))
if msg[2][-1] == '\n':
text = msg[2][:-1]
else:
text = msg[2]
self.print_conversation_line(text, jid, kind, name, tim)