Yann Leboulanger pushed to branch xep-0319 at gajim / gajim
Commits:
a5fa072f by Yann Leboulanger at 2017-07-28T14:42:23+02:00
correctly get autoaway config value
send XEP-0319 idle tag to groupchat presences
fix coming back from autoaway
- - - - -
3 changed files:
- gajim/common/connection.py
- gajim/gui_interface.py
- gajim/roster_window.py
Changes:
=====================================
gajim/common/connection.py
=====================================
--- a/gajim/common/connection.py
+++ b/gajim/common/connection.py
@@ -634,10 +634,10 @@ class CommonConnection:
idle_time = None
if auto:
global HAS_IDLE
- if HAS_IDLE and gajim.config.get_per('accounts', self.name,
- 'autoaway'):
+ if HAS_IDLE and gajim.config.get('autoaway'):
idle_sec = int(self.sleeper.getIdleSec())
- idle_time = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(time.time() - idle_sec))
+ idle_time = time.strftime('%Y-%m-%dT%H:%M:%SZ',
+ time.gmtime(time.time() - idle_sec))
gajim.nec.push_incoming_event(BeforeChangeShowEvent(None,
conn=self, show=show, message=msg))
if was_invisible:
@@ -2697,7 +2697,7 @@ class Connection(CommonConnection, ConnectionHandlers):
destroy.setAttr('jid', jid)
self.connection.send(iq)
- def send_gc_status(self, nick, jid, show, status):
+ def send_gc_status(self, nick, jid, show, status, auto=False):
if not gajim.account_is_connected(self.name):
return
if show == 'invisible':
@@ -2716,6 +2716,14 @@ class Connection(CommonConnection, ConnectionHandlers):
if gajim.config.get('send_sha_in_gc_presence') and show != 'offline':
p = self.add_sha(p, ptype != 'unavailable')
self.add_lang(p)
+ if auto:
+ global HAS_IDLE
+ if HAS_IDLE and gajim.config.get('autoaway'):
+ idle_sec = int(self.sleeper.getIdleSec())
+ idle_time = time.strftime('%Y-%m-%dT%H:%M:%SZ',
+ time.gmtime(time.time() - idle_sec))
+ idle = p.setTag('idle', namespace=nbxmpp.NS_IDLE)
+ idle.setAttr('since', idle_time)
# send instantly so when we go offline, status is sent to gc before we
# disconnect from jabber server
self.connection.send(p)
=====================================
gajim/gui_interface.py
=====================================
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -2262,10 +2262,10 @@ class Interface:
gajim.status_before_autoaway[account] = ''
gajim.sleeper_state[account] = 'off'
elif state == sleepy.STATE_AWAY and gajim.config.get('autoaway'):
- # we save out online status
- gajim.status_before_autoaway[account] = \
- gajim.connections[account].status
if gajim.sleeper_state[account] == 'online':
+ # we save out online status
+ gajim.status_before_autoaway[account] = \
+ gajim.connections[account].status
# we go away (no auto status) [we pass True to auto param]
auto_message = gajim.config.get('autoaway_message')
if not auto_message:
@@ -2279,11 +2279,15 @@ class Interface:
}
self.roster.send_status(account, 'away', auto_message,
auto=True)
- if gajim.sleeper_state[account] == 'off':
+ gajim.sleeper_state[account] = 'autoaway'
+ elif gajim.sleeper_state[account] == 'off':
+ # we save out online status
+ gajim.status_before_autoaway[account] = \
+ gajim.connections[account].status
connected = gajim.connections[account].connected
self.roster.send_status(account, gajim.SHOW_LIST[connected],
gajim.status_before_autoaway[account], auto=True)
- gajim.sleeper_state[account] = 'idle'
+ gajim.sleeper_state[account] = 'idle'
elif state == sleepy.STATE_XA and \
gajim.sleeper_state[account] in ('online', 'autoaway',
'autoaway-forced') and gajim.config.get('autoxa'):
=====================================
gajim/roster_window.py
=====================================
--- a/gajim/roster_window.py
+++ b/gajim/roster_window.py
@@ -2191,7 +2191,8 @@ class RosterWindow:
if gc_control.account == account:
if gajim.gc_connected[account][gc_control.room_jid]:
gajim.connections[account].send_gc_status(
- gc_control.nick, gc_control.room_jid, status, txt)
+ gc_control.nick, gc_control.room_jid, status, txt,
+ auto=auto)
if was_invisible and status != 'offline':
# We come back from invisible, join bookmarks
gajim.interface.auto_join_bookmarks(account)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/a5fa072f2b04fa834112ed468ad283cd3e…
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
ce2be452 by Philipp Hörist at 2017-07-28T14:32:00+02:00
Update ChangeLog
- - - - -
958c4ff1 by Philipp Hörist at 2017-07-28T14:32:10+02:00
Add .gitignore
- - - - -
2 changed files:
- + .gitignore
- ChangeLog
Changes:
=====================================
.gitignore
=====================================
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+build/
\ No newline at end of file
=====================================
ChangeLog
=====================================
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,14 @@
-python-nbxmpp 0.5.7 (26 Juli 2017)
+python-nbxmpp 0.6.0 (tba)
+ * Add new getOriginID/SetOriginID method for Messages
* Add new getJid() method for Protocol
- * Return Protocol instances when using certain Node methods
+ * getTagAttr() accepts now a Namespace to filter
+ * Return Protocol/Message instance when using getTag()
* Add new XEP Namespaces
+ Attention:
+ The API for getTag() changed in the way that it always returns a Protocol or Message instance now instead of a Node instance before. This means 'to' and 'from' attributes return now a JID instance instead of a string
+
python-nbxmpp 0.5.6 (03 June 2017)
* Support XEP-0198 Version 1.5.2
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/21b06c5d677f9fe61749fd34b…
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
d8e4ed3e by Philipp Hörist at 2017-07-28T11:17:14+02:00
Fix new getTag method working with Python 2
- - - - -
1 changed file:
- nbxmpp/protocol.py
Changes:
=====================================
nbxmpp/protocol.py
=====================================
--- a/nbxmpp/protocol.py
+++ b/nbxmpp/protocol.py
@@ -961,7 +961,7 @@ class Protocol(Node):
"""
Return at least a Protocol instance, so we dont fall back to simplexml level
"""
- tag = super().getTag(name, attrs, namespace)
+ tag = super(Protocol, self).getTag(name, attrs, namespace)
if not tag:
return None
@@ -1098,7 +1098,7 @@ class Message(Protocol):
"""
Return Message instance, fallback to Protocol
"""
- tag = super().getTag(name, attrs, namespace)
+ tag = super(Message, self).getTag(name, attrs, namespace)
if not tag:
return tag
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/d8e4ed3e7f198a03279f47aa0b…
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
8558a436 by Philipp Hörist at 2017-07-28T00:34:18+02:00
Update config setting description
We dont use 0136 anymore
- - - - -
1 changed file:
- gajim/common/config.py
Changes:
=====================================
gajim/common/config.py
=====================================
--- a/gajim/common/config.py
+++ b/gajim/common/config.py
@@ -365,7 +365,7 @@ class Config:
'custom_host': [ opt_str, '', '', True ],
'sync_with_global_status': [ opt_bool, False, ],
'no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')],
- 'sync_logs_with_server': [ opt_bool, True, _('On startup, Gajim will download logs stored on server, provided it supports XEP-0136 or XEP-0313')],
+ 'sync_logs_with_server': [ opt_bool, True, _('On startup, Gajim will download logs stored on server, provided the server supports XEP-0313')],
'allow_no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')],
'non_minimized_gc': [ opt_str, '' ],
'attached_gpg_keys': [ opt_str, '' ],
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/8558a4365197ac582842c8a54c85001393…
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
1e313cc7 by Philipp Hörist at 2017-07-27T22:14:29+02:00
Improve getting own jid
We get our full JID on the bind event.
After that it is saved in the `registered_name` attr on the Connection
Object.
In case the bind never occured we get the bare JID from config.
- - - - -
2 changed files:
- gajim/common/connection.py
- gajim/common/connection_handlers_events.py
Changes:
=====================================
gajim/common/connection.py
=====================================
--- a/gajim/common/connection.py
+++ b/gajim/common/connection.py
@@ -671,6 +671,8 @@ class Connection(CommonConnection, ConnectionHandlers):
self.try_connecting_for_foo_secs = 45
# holds the actual hostname to which we are connected
self.connected_hostname = None
+ # Holds the full jid we received on the bind event
+ self.registered_name = None
self.redirected = None
self.last_time_to_reconnect = None
self.new_account_info = None
@@ -754,19 +756,16 @@ class Connection(CommonConnection, ConnectionHandlers):
def check_jid(self, jid):
return helpers.parse_jid(jid)
- def get_own_jid(self, full=False):
+ def get_own_jid(self):
"""
- Return our own jid as JID
- If full = True, this raises an exception if we cant provide
- the full JID
+ Return the last full JID we received on a bind event.
+ In case we were never connected it returns the bare JID from config.
"""
- if self.connection:
- full_jid = self.connection._registered_name
- return nbxmpp.JID(full_jid)
+ if self.registered_name:
+ # This returns the full jid we received on the bind event
+ return self.registered_name
else:
- if full:
- raise exceptions.GajimGeneralException(
- 'We are not connected, full JID unknown.')
+ # This returns the bare jid
return nbxmpp.JID(gajim.get_jid_from_account(self.name))
def reconnect(self):
@@ -1465,6 +1464,7 @@ class Connection(CommonConnection, ConnectionHandlers):
return
if hasattr(con, 'Resource'):
self.server_resource = con.Resource
+ self.registered_name = con._registered_name
if gajim.config.get_per('accounts', self.name, 'anonymous_auth'):
# Get jid given by server
old_jid = gajim.get_jid_from_account(self.name)
=====================================
gajim/common/connection_handlers_events.py
=====================================
--- a/gajim/common/connection_handlers_events.py
+++ b/gajim/common/connection_handlers_events.py
@@ -1146,7 +1146,7 @@ class MessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
self.encrypted = False
account = self.conn.name
- if self.stanza.getFrom() == self.conn.get_own_jid(full=True):
+ if self.stanza.getFrom() == self.conn.get_own_jid():
# Drop messages sent from our own full jid
# It can happen that when we sent message to our own bare jid
# that the server routes that message back to us
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/1e313cc7e286cf20ee589e6856a0be8a89…
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
914935f8 by Philipp Hörist at 2017-07-27T21:50:38+02:00
Use right amount of arguments on pack_start
- - - - -
1 changed file:
- gajim/gtkgui_helpers.py
Changes:
=====================================
gajim/gtkgui_helpers.py
=====================================
--- a/gajim/gtkgui_helpers.py
+++ b/gajim/gtkgui_helpers.py
@@ -856,7 +856,7 @@ def create_list_multi(value_list, selected_values=None):
col = Gtk.TreeViewColumn()
treeview.append_column(col)
cell = Gtk.CellRendererText()
- col.pack_start(cell, True, True, 0)
+ col.pack_start(cell, True)
col.set_attributes(cell, text=0)
for value in value_list:
iter = liststore.append(value)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/914935f86426fa7b9f969c775ae2e7466d…