changeset 77d98dfb504f in /home/hg/repos/gajim
author: Yann Leboulanger asterix@lagaule.org branches: gajim_0.16 details:http://hg.gajim.org/gajim?cmd=changeset;node=77d98dfb504f description: rename msg_id to msg_log_id where it's the id from logs database
diffstat:
src/chat_control.py | 8 ++++---- src/common/connection_handlers_events.py | 2 +- src/common/contacts.py | 4 ++-- src/common/logger.py | 10 +++++----- src/groupchat_control.py | 6 +++--- src/roster_window.py | 20 ++++++++++---------- src/session.py | 18 +++++++++--------- 7 files changed, 34 insertions(+), 34 deletions(-)
diffs (266 lines):
diff -r 38868f5ccd7c -r 77d98dfb504f src/chat_control.py --- a/src/chat_control.py Tue Apr 19 23:43:01 2016 +0200 +++ b/src/chat_control.py Sat Feb 27 19:52:46 2016 +0100 @@ -907,7 +907,7 @@ def print_conversation_line(self, text, kind, name, tim, other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[], count_as_new=True, subject=None, old_kind=None, xhtml=None, simple=False, - xep0184_id=None, graphics=True, displaymarking=None, msg_id=None, + xep0184_id=None, graphics=True, displaymarking=None, msg_log_id=None, correct_id=None): """ Print 'chat' type messages @@ -983,7 +983,7 @@ self.account, self.contact, type_)
event = gajim.events.create_event(type_, (text, subject, self, - msg_id), show_in_roster=show_in_roster, + msg_log_id), show_in_roster=show_in_roster, show_in_systray=show_in_systray) gajim.events.add_event(self.account, full_jid, event) # We need to redraw contact if we show in roster @@ -2508,7 +2508,7 @@
def print_conversation(self, text, frm='', tim=None, encrypted=False, subject=None, xhtml=None, simple=False, xep0184_id=None, - displaymarking=None, msg_id=None, correct_id=None): + displaymarking=None, msg_log_id=None, correct_id=None): """ Print a line in the conversation
@@ -2573,7 +2573,7 @@ ChatControlBase.print_conversation_line(self, text, kind, name, tim, subject=subject, old_kind=self.old_msg_kind, xhtml=xhtml, simple=simple, xep0184_id=xep0184_id, displaymarking=displaymarking, - msg_id=msg_id, correct_id=correct_id) + msg_log_id=msg_log_id, correct_id=correct_id) if text.startswith('/me ') or text.startswith('/me\n'): self.old_msg_kind = None else: diff -r 38868f5ccd7c -r 77d98dfb504f src/common/connection_handlers_events.py --- a/src/common/connection_handlers_events.py Tue Apr 19 23:43:01 2016 +0200 +++ b/src/common/connection_handlers_events.py Sat Feb 27 19:52:46 2016 +0100 @@ -1405,7 +1405,7 @@ self.sent = self.msg_obj.sent self.conn = self.msg_obj.conn self.popup = False - self.msg_id = None # id in log database + self.msg_log_id = None # id in log database self.attention = False # XEP-0224 self.correct_id = None # XEP-0308 self.msghash = None diff -r 38868f5ccd7c -r 77d98dfb504f src/common/contacts.py --- a/src/common/contacts.py Tue Apr 19 23:43:01 2016 +0200 +++ b/src/common/contacts.py Sat Feb 27 19:52:46 2016 +0100 @@ -92,7 +92,7 @@ """ def __init__(self, jid, account, name='', groups=[], show='', status='', sub='', ask='', resource='', priority=0, keyID='', client_caps=None, - our_chatstate=None, chatstate=None, last_status_time=None, msg_id=None, + our_chatstate=None, chatstate=None, last_status_time=None, msg_log_id=None, last_activity_time=None):
CommonContact.__init__(self, jid, account, resource, show, status, name, @@ -106,7 +106,7 @@
self.priority = priority self.keyID = keyID - self.msg_id = msg_id + self.msg_log_id = msg_log_id self.last_status_time = last_status_time self.last_activity_time = last_activity_time
diff -r 38868f5ccd7c -r 77d98dfb504f src/common/logger.py --- a/src/common/logger.py Tue Apr 19 23:43:01 2016 +0200 +++ b/src/common/logger.py Sat Feb 27 19:52:46 2016 +0100 @@ -448,12 +448,12 @@ sql = 'DELETE FROM unread_messages WHERE message_id IN (%s)' % ids self.simple_commit(sql)
- def set_shown_unread_msgs(self, msg_id): + def set_shown_unread_msgs(self, msg_log_id): """ Mark unread message as shown un GUI """ sql = 'UPDATE unread_messages SET shown = 1 where message_id = %s' % \ - msg_id + msg_log_id self.simple_commit(sql)
def reset_shown_unread_messages(self): @@ -475,7 +475,7 @@ except Exception: pass for message in results: - msg_id = message[0] + msg_log_id = message[0] shown = message[1] # here we get infos for that message, and related jid from jids table # do NOT change order of SELECTed things, unless you change function(s) @@ -485,12 +485,12 @@ jids.jid FROM logs, jids WHERE logs.log_line_id = %d AND logs.jid_id = jids.jid_id - ''' % msg_id + ''' % msg_log_id ) results = self.cur.fetchall() if len(results) == 0: # Log line is no more in logs table. remove it from unread_messages - self.set_read_messages([msg_id]) + self.set_read_messages([msg_log_id]) continue all_messages.append(results[0] + (shown,)) return all_messages diff -r 38868f5ccd7c -r 77d98dfb504f src/groupchat_control.py --- a/src/groupchat_control.py Tue Apr 19 23:43:01 2016 +0200 +++ b/src/groupchat_control.py Sat Feb 27 19:52:46 2016 +0100 @@ -1074,14 +1074,14 @@ correct_id=(obj.stanza.getID(), None)) obj.needs_highlight = self.needs_visual_notification(obj.msgtxt)
- def on_private_message(self, nick, msg, tim, xhtml, session, msg_id=None, + def on_private_message(self, nick, msg, tim, xhtml, session, msg_log_id=None, encrypted=False, displaymarking=None): # Do we have a queue? fjid = self.room_jid + '/' + nick no_queue = len(gajim.events.get_events(self.account, fjid)) == 0
event = gajim.events.create_event('pm', (msg, '', 'incoming', tim, - encrypted, '', msg_id, xhtml, session, None, displaymarking, False)) + encrypted, '', msg_log_id, xhtml, session, None, displaymarking, False)) gajim.events.add_event(self.account, fjid, event)
autopopup = gajim.config.get('autopopup') @@ -1373,7 +1373,7 @@ else: # otherwise pass it off to the control to be queued self.on_private_message(nick, obj.msgtxt, obj.timestamp, - obj.xhtml, self.session, msg_id=obj.msg_id, + obj.xhtml, self.session, msg_log_id=obj.msg_log_id, encrypted=obj.encrypted, displaymarking=obj.displaymarking)
def _nec_ping_reply(self, obj): diff -r 38868f5ccd7c -r 77d98dfb504f src/roster_window.py --- a/src/roster_window.py Tue Apr 19 23:43:01 2016 +0200 +++ b/src/roster_window.py Sat Feb 27 19:52:46 2016 +0100 @@ -1846,7 +1846,7 @@
tim = time.localtime(float(result[2])) session.roster_message(jid, result[1], tim, msg_type='chat', - msg_id=result[0]) + msg_log_id=result[0]) gajim.logger.set_shown_unread_msgs(result[0])
elif (time.time() - result[2]) > 2592000: @@ -1947,16 +1947,16 @@ pending events """
- msg_ids = [] + msg_log_ids = [] for ev in event_list: if ev.type_ != 'printed_chat': continue if len(ev.parameters) > 3 and ev.parameters[3]: - # There is a msg_id - msg_ids.append(ev.parameters[3]) - - if msg_ids: - gajim.logger.set_read_messages(msg_ids) + # There is a msg_log_id + msg_log_ids.append(ev.parameters[3]) + + if msg_log_ids: + gajim.logger.set_read_messages(msg_log_ids)
contact_list = ((event.jid.split('/')[0], event.account) for event in \ event_list) @@ -2746,14 +2746,14 @@ obj.session.control.print_conversation(obj.msgtxt, typ, tim=obj.timestamp, encrypted=obj.encrypted, subject=obj.subject, xhtml=obj.xhtml, displaymarking=obj.displaymarking, - msg_id=obj.msg_id, correct_id=(obj.id_, obj.correct_id), + msg_log_id=obj.msg_log_id, correct_id=(obj.id_, obj.correct_id), xep0184_id=xep0184_id) - if obj.msg_id: + if obj.msg_log_id: pw = obj.session.control.parent_win end = obj.session.control.was_at_the_end if not pw or (pw.get_active_control() and obj.session.control \ == pw.get_active_control() and pw.is_active() and end): - gajim.logger.set_read_messages([obj.msg_id]) + gajim.logger.set_read_messages([obj.msg_log_id]) elif obj.popup and obj.mtype == 'chat': contact = gajim.contacts.get_contact(obj.conn.name, obj.jid) obj.session.control = gajim.interface.new_chat(contact, diff -r 38868f5ccd7c -r 77d98dfb504f src/session.py --- a/src/session.py Tue Apr 19 23:43:01 2016 +0200 +++ b/src/session.py Sat Feb 27 19:52:46 2016 +0100 @@ -99,7 +99,7 @@ msg_to_log = obj.xhtml else: msg_to_log = obj.msgtxt - obj.msg_id = gajim.logger.write(log_type, obj.fjid, + obj.msg_log_id = gajim.logger.write(log_type, obj.fjid, msg_to_log, tim=obj.timestamp, subject=obj.subject) except exceptions.PysqliteOperationalError, e: gajim.nec.push_incoming_event(InformationEvent(None, @@ -142,8 +142,8 @@ # Brand new message, incoming. contact.our_chatstate = obj.chatstate contact.chatstate = obj.chatstate - if obj.msg_id: # Do not overwrite an existing msg_id with None - contact.msg_id = obj.msg_id + if obj.msg_log_id: # Do not overwrite an existing msg_log_id with None + contact.msg_log_id = obj.msg_log_id
# THIS MUST BE AFTER chatstates handling # AND BEFORE playsound (else we ear sounding on chatstates!) @@ -182,7 +182,7 @@ gajim.interface.remote_ctrl.raise_signal('NewMessage', ( self.conn.name, [obj.fjid, obj.msgtxt, obj.timestamp, obj.encrypted, obj.mtype, obj.subject, obj.chatstate, - obj.msg_id, obj.user_nick, obj.xhtml, obj.form_node])) + obj.msg_log_id, obj.user_nick, obj.xhtml, obj.form_node]))
def roster_message2(self, obj): """ @@ -255,7 +255,7 @@ (obj.mtype == 'normal' and not obj.popup): event = gajim.events.create_event(type_, (obj.msgtxt, obj.subject, obj.mtype, obj.timestamp, obj.encrypted, obj.resource, - obj.msg_id, obj.xhtml, self, obj.form_node, obj.displaymarking, + obj.msg_log_id, obj.xhtml, self, obj.form_node, obj.displaymarking, obj.forwarded and obj.sent), show_in_roster=obj.show_in_roster, show_in_systray=obj.show_in_systray) @@ -263,7 +263,7 @@ gajim.events.add_event(self.conn.name, fjid, event)
def roster_message(self, jid, msg, tim, encrypted=False, msg_type='', - subject=None, resource='', msg_id=None, user_nick='', xhtml=None, + subject=None, resource='', msg_log_id=None, user_nick='', xhtml=None, form_node=None, displaymarking=None): """ Display the message or show notification in the roster @@ -332,8 +332,8 @@ self.control.print_conversation(msg, typ, tim=tim, encrypted=encrypted, subject=subject, xhtml=xhtml, displaymarking=displaymarking)
- if msg_id: - gajim.logger.set_read_messages([msg_id]) + if msg_log_id: + gajim.logger.set_read_messages([msg_log_id])
return
@@ -351,7 +351,7 @@ contact)
event = gajim.events.create_event(type_, (msg, subject, msg_type, tim, - encrypted, resource, msg_id, xhtml, self, form_node, displaymarking, + encrypted, resource, msg_log_id, xhtml, self, form_node, displaymarking, False), show_in_roster=show_in_roster, show_in_systray=show_in_systray)