xmpppy gives us the UTC time, we convert it to localtime

This commit is contained in:
Yann Leboulanger 2005-04-27 18:26:31 +00:00
parent b372567405
commit eef71fcb27
2 changed files with 23 additions and 1 deletions

View File

@ -20,6 +20,7 @@
import sys import sys
import os import os
import time import time
from calendar import timegm
import common.xmpp import common.xmpp
@ -169,8 +170,8 @@ class Connection:
"""Called when we recieve a message""" """Called when we recieve a message"""
mtype = msg.getType() mtype = msg.getType()
tim = msg.getTimestamp() tim = msg.getTimestamp()
print tim
tim = time.strptime(tim, '%Y%m%dT%H:%M:%S') tim = time.strptime(tim, '%Y%m%dT%H:%M:%S')
tim = time.localtime(timegm(tim))
msgtxt = msg.getBody() msgtxt = msg.getBody()
xtags = msg.getTags('x') xtags = msg.getTags('x')
encTag = None encTag = None

View File

@ -184,7 +184,28 @@ class Preferences_window:
buf2 = {} buf2 = {}
jids = {} jids = {}
if widget.get_active(): if widget.get_active():
#save buffers and close windows
for acct in gajim.connections:
buf1[acct] = {}
buf2[acct] = {}
jids[acct] = self.plugin.windows[acct]['chats'].keys()
for jid in jids[acct]:
buf1[acct][jid] = self.plugin.windows[acct]['chats'][jid].\
xmls[jid].get_widget('conversation_textview').get_buffer()
buf2[acct][jid] = self.plugin.windows[acct]['chats'][jid].\
xmls[jid].get_widget('message_textview').get_buffer()
self.plugin.windows[acct]['chats'][jid].window.destroy()
gajim.config.set('usetabbedchat', True) gajim.config.set('usetabbedchat', True)
#open new tabbed chat windows
for acct in gajim.connections:
for jid in jids[acct]:
user = self.plugin.roster.contacts[acct][jid][0]
self.plugin.roster.new_chat(user, acct)
self.plugin.windows[acct]['chats'][jid].xmls[jid].\
get_widget('conversation_textview').set_buffer(\
buf1[acct][jid])
self.plugin.windows[acct]['chats'][jid].xmls[jid].\
get_widget('message_textview').set_buffer(buf2[acct][jid])
else: else:
gajim.config.set('usetabbedchat', False) gajim.config.set('usetabbedchat', False)
self.plugin.save_config() self.plugin.save_config()