Changeset 7829 for branches/gajim_0.11/src
- Timestamp:
- 01/13/07 23:35:41 (20 months ago)
- Location:
- branches/gajim_0.11/src
- Files:
-
- 28 modified
-
adhoc_commands.py (modified) (5 diffs)
-
chat_control.py (modified) (8 diffs)
-
common/commands.py (modified) (1 diff)
-
common/config.py (modified) (1 diff)
-
common/connection_handlers.py (modified) (2 diffs)
-
common/connection.py (modified) (5 diffs)
-
common/dataforms.py (modified) (1 diff)
-
common/defs.py (modified) (1 diff)
-
common/GnuPG.py (modified) (2 diffs)
-
common/logger.py (modified) (3 diffs)
-
common/optparser.py (modified) (3 diffs)
-
common/passwords.py (modified) (1 diff)
-
common/sleepy.py (modified) (7 diffs)
-
common/xmpp/features_nb.py (modified) (1 diff)
-
config.py (modified) (7 diffs)
-
conversation_textview.py (modified) (2 diffs)
-
dialogs.py (modified) (2 diffs)
-
gajim.py (modified) (2 diffs)
-
gajim-remote.py (modified) (3 diffs)
-
groupchat_control.py (modified) (10 diffs)
-
gtkgui_helpers.py (modified) (1 diff)
-
history_window.py (modified) (1 diff)
-
htmltextview.py (modified) (2 diffs)
-
message_control.py (modified) (1 diff)
-
notify.py (modified) (1 diff)
-
profile_window.py (modified) (3 diffs)
-
remote_control.py (modified) (15 diffs)
-
roster_window.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/gajim_0.11/src/adhoc_commands.py
r7662 r7829 267 267 if self.data_form_widget.get_data_form() is None: 268 268 self.data_form_widget.hide() 269 else: 270 self.data_form_widget.data_form.type='submit' 269 271 270 272 self.close_button.set_sensitive(True) … … 297 299 # FIXME: translate 298 300 self.stage5(error='Service sent malformed data', senderror=True) 301 return 299 302 self.data_form_widget.show() 303 if self.data_form_widget.title: 304 self.window.set_title("%s - Ad-hoc Commands - Gajim" % \ 305 self.data_form_widget.title) 300 306 else: 301 307 self.data_form_widget.hide() … … 466 472 # cmdnode.addChild(node=dataforms.DataForm(tofill=self.data_form_widget.data_form)) 467 473 # FIXME: simplified form to send 474 468 475 cmdnode.addChild(node=self.data_form_widget.data_form) 469 476 … … 481 488 '''Send the command with action='cancel'. ''' 482 489 assert self.commandnode is not None 483 if self.sessionid is not None :490 if self.sessionid is not None and self.account.connection: 484 491 # we already have sessionid, so the service sent at least one reply. 485 492 stanza = xmpp.Iq(typ='set', to=self.jid) … … 490 497 'action':'cancel' 491 498 }) 492 499 493 500 self.account.connection.send(stanza) 494 501 else: -
branches/gajim_0.11/src/chat_control.py
r7787 r7829 92 92 93 93 def draw_banner(self): 94 self._paint_banner() 94 '''Draw the fat line at the top of the window that 95 houses the icon, jid, ... 96 ''' 97 self.draw_banner_text() 95 98 self._update_banner_state_image() 96 # Derived types SHOULD implement this 99 # Derived types MAY implement this 100 101 def draw_banner_text(self): 102 pass # Derived types SHOULD implement this 97 103 98 104 def update_ui(self): … … 101 107 102 108 def repaint_themed_widgets(self): 109 self._paint_banner() 103 110 self.draw_banner() 104 111 # Derived classes MAY implement this … … 209 216 self.style_event_id = 0 210 217 self.conv_textview.tv.show() 218 self._paint_banner() 211 219 212 220 # For JEP-0172 … … 850 858 self.handlers[id] = widget 851 859 852 self.hide_chat_buttons_always = gajim.config.get(860 hide_chat_buttons_always = gajim.config.get( 853 861 'always_hide_chat_buttons') 854 self.chat_buttons_set_visible( self.hide_chat_buttons_always)862 self.chat_buttons_set_visible(hide_chat_buttons_always) 855 863 self.widget_set_visible(self.xml.get_widget('banner_eventbox'), 856 864 gajim.config.get('hide_chat_banner')) … … 1012 1020 self._update_gpg() 1013 1021 1014 def draw_banner(self, chatstate = None): 1015 '''Draw the fat line at the top of the window that 1016 houses the status icon, name, jid. The chatstate arg should 1017 only be used if the control's chatstate member is NOT to be use, such as 1018 composing, paused, etc. 1022 def draw_banner_text(self): 1023 '''Draw the text in the fat line at the top of the window that 1024 houses the name, jid. 1019 1025 ''' 1020 ChatControlBase.draw_banner(self)1021 1022 1026 contact = self.contact 1023 1027 jid = contact.jid … … 1071 1075 else: 1072 1076 chatstate = '' 1073 elif chatstate is None: 1077 else: 1078 # When does that happen ? See [7797] and [7804] 1074 1079 chatstate = helpers.get_uf_chatstate(cs) 1075 1080 … … 1552 1557 def handle_incoming_chatstate(self): 1553 1558 ''' handle incoming chatstate that jid SENT TO us ''' 1554 self.draw_banner ()1559 self.draw_banner_text() 1555 1560 # update chatstate in tab for this chat 1556 1561 self.parent_win.redraw_tab(self, self.contact.chatstate) … … 1650 1655 constants.KIND_CHAT_MSG_RECV): 1651 1656 kind = 'incoming' 1657 name = self.contact.get_shown_name() 1658 elif row[1] == constants.KIND_ERROR: 1659 kind = 'status' 1652 1660 name = self.contact.get_shown_name() 1653 1661 -
branches/gajim_0.11/src/common/commands.py
r7669 r7829 129 129 cmd.addChild('note', {}, 'The status has been changed.') 130 130 131 self.connection.connection.send(response) 131 # if going offline, we need to push response so it won't go into 132 # queue and disappear 133 self.connection.connection.send(response, presencetype=='offline') 132 134 133 135 # send new status -
branches/gajim_0.11/src/common/config.py
r7787 r7829 131 131 'latest_disco_addresses': [ opt_str, '' ], 132 132 'recently_groupchat': [ opt_str, '' ], 133 'before_time': [ opt_str, '[' ],134 'after_time': [ opt_str, ']' ],135 133 'before_nickname': [ opt_str, '' ], 134 'time_stamp': [ opt_str, '[%H:%M] ' ], 136 135 'after_nickname': [ opt_str, ':' ], 137 136 'send_os_info': [ opt_bool, True ], -
branches/gajim_0.11/src/common/connection_handlers.py
r7787 r7829 25 25 import sys 26 26 27 from time import localtime, strftime, gmtime , timezone27 from time import localtime, strftime, gmtime 28 28 from calendar import timegm 29 29 … … 887 887 c = f.read() 888 888 f.close() 889 card = common.xmpp.Node(node = c) 889 try: 890 card = common.xmpp.Node(node = c) 891 except: 892 # We are unable to parse it. Remove it 893 os.remove(path_to_file) 894 return None 890 895 vcard = self.node_to_dict(card) 891 896 if vcard.has_key('PHOTO'): -
branches/gajim_0.11/src/common/connection.py
r7634 r7829 80 80 self.continue_connect_info = None 81 81 if USE_GPG: 82 self.gpg = GnuPG.GnuPG( )82 self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) 83 83 gajim.config.set('usegpg', True) 84 84 else: … … 197 197 self.password = self.new_account_info['password'] 198 198 if USE_GPG: 199 self.gpg = GnuPG.GnuPG( )199 self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) 200 200 gajim.config.set('usegpg', True) 201 201 else: … … 489 489 if not self.connection: 490 490 return 491 common.xmpp.features_nb.delPrivacyList(self.connection, privacy_list) 491 def _on_del_privacy_list_result(result): 492 if result: 493 self.dispatch('PRIVACY_LIST_REMOVED', privacy_list) 494 else: 495 self.dispatch('ERROR', (_('Error while removing privacy list'), 496 _('Privacy list %s has not been removed. It is maybe active in ' 497 'one of your connected resources. Desactivate it and try ' 498 'again.') % privacy_list)) 499 common.xmpp.features_nb.delPrivacyList(self.connection, privacy_list, 500 _on_del_privacy_list_result) 492 501 493 502 def get_privacy_list(self, title): … … 1041 1050 t.setTagData('password', password) 1042 1051 self.connection.send(p) 1052 1043 1053 #last date/time in history to avoid duplicate 1044 last_log = gajim.logger.get_last_date_that_has_logs(room_jid, 1045 is_room = True) 1046 if last_log is None: 1047 last_log = 0 1048 self.last_history_line[room_jid]= last_log 1054 if not self.last_history_line.has_key(room_jid): 1055 # Not in memory, get it from DB 1056 last_log = gajim.logger.get_last_date_that_has_logs(room_jid, 1057 is_room = True) 1058 if last_log is None: 1059 last_log = 0 1060 self.last_history_line[room_jid]= last_log 1049 1061 1050 1062 def send_gc_message(self, jid, msg, xhtml = None): … … 1091 1103 # disconnect from jabber server 1092 1104 self.connection.send(p) 1105 # Save the time we quit to avoid duplicate logs AND be faster than 1106 # get that date from DB 1107 self.last_history_line[jid] = time.time() 1093 1108 1094 1109 def gc_set_role(self, room_jid, nick, role, reason = ''): -
branches/gajim_0.11/src/common/dataforms.py
r7500 r7829 342 342 def fget(self): 343 343 return self.getAttr('type') 344 def fset(self ):344 def fset(self, type): 345 345 assert type in ('form', 'submit', 'cancel', 'result') 346 346 self.setAttr('type', type) -
branches/gajim_0.11/src/common/defs.py
r7684 r7829 3 3 datadir = '../' 4 4 5 version = '0.11 '5 version = '0.11.0.1' 6 6 7 7 import sys, os.path -
branches/gajim_0.11/src/common/GnuPG.py
r7652 r7829 44 44 45 45 class GnuPG(GnuPGInterface.GnuPG): 46 def __init__(self ):46 def __init__(self, use_agent = False): 47 47 GnuPGInterface.GnuPG.__init__(self) 48 self.use_agent = use_agent 48 49 self._setup_my_options() 49 50 … … 54 55 # Nolith's patch - prevent crashs on non fully-trusted keys 55 56 self.options.extra_args.append('--always-trust') 57 if self.use_agent: 58 self.options.extra_args.append('--use-agent') 56 59 57 60 def _read_response(self, child_stdout): -
branches/gajim_0.11/src/common/logger.py
r7787 r7829 426 426 self.cur.execute(''' 427 427 SELECT time, kind, message FROM logs 428 WHERE (%s) AND kind IN (%d, %d, %d, %d ) AND time > %d428 WHERE (%s) AND kind IN (%d, %d, %d, %d, %d) AND time > %d 429 429 ORDER BY time DESC LIMIT %d OFFSET %d 430 ''' % (where_sql, constants.KIND_SINGLE_MSG_RECV, constants.KIND_CHAT_MSG_RECV, 431 constants.KIND_SINGLE_MSG_SENT, constants.KIND_CHAT_MSG_SENT, 430 ''' % (where_sql, constants.KIND_SINGLE_MSG_RECV, 431 constants.KIND_CHAT_MSG_RECV, constants.KIND_SINGLE_MSG_SENT, 432 constants.KIND_CHAT_MSG_SENT, constants.KIND_ERROR, 432 433 timed_out, restore_how_many_rows, pending_how_many) 433 434 ) … … 516 517 result = self.cur.fetchall() 517 518 518 # Copy all interes ant timein a temporary table519 # Copy all interesting times in a temporary table 519 520 self.cur.execute('CREATE TEMPORARY TABLE blabla(time,INTEGER)') 520 521 for line in result: … … 555 556 where_sql = 'jid_id = %s' % jid_id 556 557 self.cur.execute(''' 557 SELECT timeFROM logs558 SELECT MAX(time) FROM logs 558 559 WHERE (%s) 559 560 AND kind NOT IN (%d, %d) 560 ORDER BY time DESC LIMIT 1561 561 ''' % (where_sql, constants.KIND_STATUS, constants.KIND_GCSTATUS)) 562 562 -
branches/gajim_0.11/src/common/optparser.py
r7787 r7829 14 14 15 15 import os 16 import sys17 16 import locale 18 17 from common import gajim … … 151 150 if old < [0, 10, 1, 8] and new >= [0, 10, 1, 8]: 152 151 self.update_config_to_01018() 152 if old < [0, 11, 0, 1] and new >= [0, 11, 0, 1]: 153 self.update_config_to_01101() 153 154 154 155 gajim.logger.init_vars() … … 368 369 self.old_values['chat_state_notifications']) 369 370 gajim.config.set('version', '0.10.1.8') 371 372 def update_config_to_01101(self): 373 '''fill time_stamp from before_time and after_time''' 374 if self.old_values.has_key('before_time'): 375 gajim.config.set('time_stamp', '%s%%H:%%M%s ' % ( 376 self.old_values['before_time'], self.old_values['after_time'])) 377 gajim.config.set('version', '0.11.0.1') -
branches/gajim_0.11/src/common/passwords.py
r7787 r7829 14 14 15 15 __all__ = ['get_password', 'save_password'] 16 17 import gobject18 16 19 17 from common import gajim -
branches/gajim_0.11/src/common/sleepy.py
r7787 r7829 2 2 ## 3 3 ## Contributors for this file: 4 ## - Yann Le Boulanger <asterix@lagaule.org>5 ## - Nikos Kouremenos <kourem@gmail.com>4 ## - Yann Le Boulanger <asterix@lagaule.org> 5 ## - Nikos Kouremenos <kourem@gmail.com> 6 6 ## 7 7 ## Copyright (C) 2003-2004 Yann Le Boulanger <asterix@lagaule.org> 8 ## Vincent Hanquez <tab@snarc.org>8 ## Vincent Hanquez <tab@snarc.org> 9 9 ## Copyright (C) 2005-2006 Yann Le Boulanger <asterix@lagaule.org> 10 ## Nikos Kouremenos <kourem@gmail.com>10 ## Nikos Kouremenos <kourem@gmail.com> 11 11 ## 12 12 ## This program is free software; you can redistribute it and/or modify … … 27 27 STATE_XA = 'extended away' 28 28 STATE_AWAY = 'away' 29 STATE_AWAKE = 'awake'29 STATE_AWAKE = 'awake' 30 30 31 31 SUPPORTED = True 32 32 try: 33 if os.name == 'nt':34 import ctypes33 if os.name == 'nt': 34 import ctypes 35 35 36 GetTickCount = ctypes.windll.kernel32.GetTickCount37 GetLastInputInfo = ctypes.windll.user32.GetLastInputInfo36 GetTickCount = ctypes.windll.kernel32.GetTickCount 37 GetLastInputInfo = ctypes.windll.user32.GetLastInputInfo 38 38 39 class LASTINPUTINFO(ctypes.Structure): 40 _fields_ = [('cbSize', ctypes.c_uint), 41 ('dwTime', ctypes.c_uint)] 39 class LASTINPUTINFO(ctypes.Structure): 40 _fields_ = [('cbSize', ctypes.c_uint), ('dwTime', ctypes.c_uint)] 42 41 43 lastInputInfo = LASTINPUTINFO()44 lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo)42 lastInputInfo = LASTINPUTINFO() 43 lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo) 45 44 46 else: # unix47 import idle45 else: # unix 46 import idle 48 47 except: 49 48 gajim.log.debug('Unable to load idle module') … … 51 50 52 51 class SleepyWindows: 53 def __init__(self, away_interval = 60, xa_interval = 120):52 def __init__(self, away_interval = 60, xa_interval = 120): 54 53 self.away_interval = away_interval 55 54 self.xa_interval = xa_interval 56 55 self.state = STATE_AWAKE # assume we are awake 57 56 58 def getIdleSec(self):59 GetLastInputInfo(ctypes.byref(lastInputInfo))60 idleDelta = float(GetTickCount() - lastInputInfo.dwTime) / 100061 return idleDelta57 def getIdleSec(self): 58 GetLastInputInfo(ctypes.byref(lastInputInfo)) 59 idleDelta = float(GetTickCount() - lastInputInfo.dwTime) / 1000 60 return idleDelta 62 61 63 62 def poll(self): 64 63 '''checks to see if we should change state''' 64 if not SUPPORTED: 65 return False 66 65 67 idleTime = self.getIdleSec() 66 68 67 69 # xa is stronger than away so check for xa first 68 70 if idleTime > self.xa_interval: … … 81 83 82 84 class SleepyUnix: 83 84 85 def __init__(self, away_interval = 60, xa_interval = 120): 85 86 self.away_interval = away_interval … … 92 93 self.state = STATE_UNKNOWN 93 94 94 def getIdleSec(self):95 return idle.getIdleSec()95 def getIdleSec(self): 96 return idle.getIdleSec() 96 97 97 98 def poll(self): … … 101 102 102 103 idleTime = self.getIdleSec() 103 104 104 105 # xa is stronger than away so check for xa first 105 106 if idleTime > self.xa_interval: … … 118 119 119 120 if os.name == 'nt': 120 Sleepy = SleepyWindows121 Sleepy = SleepyWindows 121 122 else: 122 Sleepy = SleepyUnix123 Sleepy = SleepyUnix -
branches/gajim_0.11/src/common/xmpp/features_nb.py
r7521 r7829 250 250 _on_default_response(disp, iq, None) 251 251 252 def delPrivacyList(disp,listname ):252 def delPrivacyList(disp,listname,cb=None): 253 253 """ Deletes privacy list 'listname'. Returns true on success.""" 254 254 iq = Iq('set',NS_PRIVACY,payload=[Node('list',{'name':listname})]) 255 _on_default_response(disp, iq, None)255 _on_default_response(disp, iq, cb) -
branches/gajim_0.11/src/config.py
r7787 r7829 241 241 self.xml.get_widget('time_always_radiobutton').set_active(True) 242 242 243 # before time244 st = gajim.config.get(' before_time')243 # TimeStamp 244 st = gajim.config.get('time_stamp') 245 245 st = helpers.from_one_line(st) 246 self.xml.get_
