Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
19d047e0 by lovetox at 2020-04-05T15:32:06+02:00
MUC: Only force role/affiliation on presences
- - - - -
1 changed file:
- nbxmpp/modules/muc.py
Changes:
=====================================
nbxmpp/modules/muc.py
=====================================
@@ -178,7 +178,8 @@ class MUC(BaseModule):
muc_user = stanza.getTag('x', namespace=NS_MUC_USER)
if muc_user is not None:
try:
- properties.muc_user = self._parse_muc_user(muc_user)
+ properties.muc_user = self._parse_muc_user(muc_user,
+ is_presence=False)
except StanzaMalformed as error:
self._log.warning(error)
self._log.warning(stanza)
@@ -540,7 +541,7 @@ class MUC(BaseModule):
return CommonResult(jid=stanza.getFrom())
@staticmethod
- def _parse_muc_user(muc_user):
+ def _parse_muc_user(muc_user, is_presence=True):
item = muc_user.getTag('item')
if item is None:
return None
@@ -548,22 +549,26 @@ class MUC(BaseModule):
item_dict = item.getAttrs()
role = item_dict.get('role')
- if role is None:
- raise StanzaMalformed('role attr missing')
+ if role is not None:
+ try:
+ role = Role(role)
+ except ValueError:
+ raise StanzaMalformed('invalid role %s' % role)
- try:
- role = Role(role)
- except ValueError:
- raise StanzaMalformed('invalid role %s' % role)
+ elif is_presence:
+ # role attr MUST be included in all presence broadcasts
+ raise StanzaMalformed('role attr missing')
affiliation = item_dict.get('affiliation')
- if affiliation is None:
- raise StanzaMalformed('affiliation attr missing')
+ if affiliation is not None:
+ try:
+ affiliation = Affiliation(affiliation)
+ except ValueError:
+ raise StanzaMalformed('invalid affiliation %s' % affiliation)
- try:
- affiliation = Affiliation(affiliation)
- except ValueError:
- raise StanzaMalformed('invalid affiliation %s' % affiliation)
+ elif is_presence:
+ # affiliation attr MUST be included in all presence broadcasts
+ raise StanzaMalformed('affiliation attr missing')
jid = item_dict.get('jid')
if jid is not None:
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/19d047e08a3e7cf3ac3e7a9d…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/19d047e08a3e7cf3ac3e7a9d…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
8a60259a by lovetox at 2020-04-05T13:28:49+02:00
Adapt connection state checks
- - - - -
9 changed files:
- gajim/command_system/implementation/standard.py
- gajim/common/client.py
- gajim/common/helpers.py
- gajim/common/jingle_session.py
- gajim/common/modules/presence.py
- gajim/gtk/remove_account.py
- gajim/gtk/settings.py
- gajim/gui_interface.py
- gajim/roster_window.py
Changes:
=====================================
gajim/command_system/implementation/standard.py
=====================================
@@ -137,7 +137,7 @@ class StandardCommonCommands(CommandContainer):
if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'):
continue
- if not connection.state.is_connected:
+ if not connection.state.is_available:
continue
connection.change_status(status, message)
@@ -151,7 +151,7 @@ class StandardCommonCommands(CommandContainer):
if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'):
continue
- if not connection.state.is_connected:
+ if not connection.state.is_available:
continue
connection.change_status('away', message)
@@ -165,7 +165,7 @@ class StandardCommonCommands(CommandContainer):
if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'):
continue
- if not connection.state.is_connected:
+ if not connection.state.is_available:
continue
connection.change_status('online', message)
=====================================
gajim/common/client.py
=====================================
@@ -442,7 +442,7 @@ class Client(ConnectionHandlers):
return self._client.send_stanza(stanza)
def send_message(self, message):
- if not self._state.is_connected:
+ if not self._state.is_available:
log.warning('Trying to send message while offline')
return
@@ -477,7 +477,7 @@ class Client(ConnectionHandlers):
self.get_module('Message').log_message(message)
def send_messages(self, jids, message):
- if not self._state.is_connected:
+ if not self._state.is_available:
log.warning('Trying to send message while offline')
return
=====================================
gajim/common/helpers.py
=====================================
@@ -690,7 +690,7 @@ def get_connection_status(account):
if con.state.is_reconnect_scheduled:
return 'error'
- if con.state.is_connecting:
+ if con.state.is_connecting or con.state.is_connected:
return 'connecting'
if con.state.is_disconnected:
=====================================
gajim/common/jingle_session.py
=====================================
@@ -758,7 +758,7 @@ class JingleSession:
def _session_terminate(self, reason=None):
stanza, jingle = self.__make_jingle('session-terminate', reason=reason)
self.__broadcast_all(stanza, jingle, None, 'session-terminate-sent')
- if self.connection.connection and self.connection.state.is_connected:
+ if self.connection.connection and self.connection.state.is_available:
self.connection.connection.send(stanza)
# TODO: Move to GUI?
reason, text = self.__reason_from_stanza(jingle)
@@ -806,7 +806,7 @@ class JingleSession:
def __content_remove(self, content, reason=None):
assert self.state != JingleStates.ENDED
- if self.connection.connection and self.connection.state.is_connected:
+ if self.connection.connection and self.connection.state.is_available:
stanza, jingle = self.__make_jingle('content-remove', reason=reason)
self.__append_content(jingle, content)
self.connection.connection.send(stanza)
=====================================
gajim/common/modules/presence.py
=====================================
@@ -198,7 +198,7 @@ class Presence(BaseModule):
if jid in app.to_be_removed[self._account]:
app.to_be_removed[self._account].remove(jid)
elif event.old_show > 1 and event.new_show == 0 and \
- self._con.state.is_connected:
+ self._con.state.is_available:
if not jid in app.to_be_removed[self._account]:
app.to_be_removed[self._account].append(jid)
if jid in app.newly_added[self._account]:
=====================================
gajim/gtk/remove_account.py
=====================================
@@ -89,7 +89,7 @@ class RemoveAccount(Assistant):
app.interface.remove_account(self.account)
def _set_remove_from_server_checkbox(self):
- enabled = self._con is not None and self._con.state.is_connected
+ enabled = self._con is not None and self._con.state.is_available
self.get_page('remove_choice').set_remove_from_server(enabled)
@staticmethod
=====================================
gajim/gtk/settings.py
=====================================
@@ -642,5 +642,5 @@ class ChangePasswordSetting(DialogSetting):
activatable = False
if self.account in app.connections:
con = app.connections[self.account]
- activatable = con.state.is_connected and con.register_supported
+ activatable = con.state.is_available and con.register_supported
self.set_activatable(activatable)
=====================================
gajim/gui_interface.py
=====================================
@@ -1959,7 +1959,8 @@ class Interface:
else:
log.info('Network connection lost')
for connection in app.connections.values():
- if connection.state.is_connected:
+ if (connection.state.is_connected or
+ connection.state.is_available):
connection.disconnect(gracefully=False, reconnect=True)
def create_zeroconf_default_config(self):
=====================================
gajim/roster_window.py
=====================================
@@ -2501,7 +2501,7 @@ class RosterWindow:
GLib.timeout_add_seconds(5, self.remove_newly_added, jid,
account)
elif obj.old_show > 1 and obj.new_show == 0 and \
- obj.conn.state.is_connected:
+ obj.conn.state.is_available:
GLib.timeout_add_seconds(5, self.remove_to_be_removed,
jid, account)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/8a60259ab793f75a37fb100d27378835…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/8a60259ab793f75a37fb100d27378835…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
446ee5a2 by lovetox at 2020-04-05T11:27:42+02:00
Fix pylint error
- - - - -
1 changed file:
- gajim/common/const.py
Changes:
=====================================
gajim/common/const.py
=====================================
@@ -248,7 +248,6 @@ class ClientState(IntEnum):
@property
def is_available(self):
return self == ClientState.AVAILABLE
-
MUC_CREATION_EXAMPLES = [
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/446ee5a292f9ea478f1b7494cce48f22…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/446ee5a292f9ea478f1b7494cce48f22…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
3d738ae7 by lovetox at 2020-04-05T11:23:12+02:00
Client: Add ClientState.AVAILABLE
When we are connected to the server we need to set some things up
before we send our initial available presence. The new state makes
it possible for other code to difference between when we are connected
and when we are available.
For example other code should not send a presence before we requested
the roster.
Fixes #9983
- - - - -
30 changed files:
- gajim/application.py
- gajim/chat_control_base.py
- gajim/common/app.py
- gajim/common/client.py
- gajim/common/const.py
- gajim/common/dbus/location.py
- gajim/common/modules/bookmarks.py
- gajim/common/modules/bytestream.py
- gajim/common/modules/caps.py
- gajim/common/modules/discovery.py
- gajim/common/modules/entity_time.py
- gajim/common/modules/gateway.py
- gajim/common/modules/metacontacts.py
- gajim/common/modules/muc.py
- gajim/common/modules/ping.py
- gajim/common/modules/presence.py
- gajim/common/modules/pubsub.py
- gajim/common/modules/register.py
- gajim/common/modules/roster.py
- gajim/common/modules/roster_item_exchange.py
- gajim/common/modules/vcard_temp.py
- gajim/dialogs.py
- gajim/groupchat_control.py
- gajim/gtk/add_contact.py
- gajim/gtk/discovery.py
- gajim/gtk/groupchat_creation.py
- gajim/gtk/profile.py
- gajim/gtk/single_message.py
- gajim/gtk/start_chat.py
- gajim/gtk/statusicon.py
The diff was not included because it is too large.
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3d738ae7ee8deb5935c30a94adf35474…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3d738ae7ee8deb5935c30a94adf35474…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
bc98b95c by lovetox at 2020-04-05T08:52:14+02:00
Presence: Remove auto auth if we unsubscribe
- - - - -
1 changed file:
- gajim/common/modules/presence.py
Changes:
=====================================
gajim/common/modules/presence.py
=====================================
@@ -59,7 +59,7 @@ class Presence(BaseModule):
self.automatically_added = []
# list of jid to auto-authorize
- self.jids_for_auto_auth = []
+ self._jids_for_auto_auth = set()
def _presence_received(self, _con, stanza, properties):
if properties.from_muc:
@@ -252,8 +252,9 @@ class Presence(BaseModule):
properties.jid, is_transport,
auto_auth, properties.nickname)
- if auto_auth or jid in self.jids_for_auto_auth:
+ if auto_auth or jid in self._jids_for_auto_auth:
self.send_presence(fjid, 'subscribed')
+ self._jids_for_auto_auth.discard(jid)
self._log.info('Auto respond with subscribed: %s', jid)
return
@@ -304,7 +305,9 @@ class Presence(BaseModule):
def unsubscribed(self, jid):
if not app.account_is_connected(self._account):
return
+
self._log.info('Unsubscribed: %s', jid)
+ self._jids_for_auto_auth.discard(jid)
self.send_presence(jid, 'unsubscribed')
def unsubscribe(self, jid, remove_auth=True):
@@ -318,6 +321,7 @@ class Presence(BaseModule):
app.config.del_per('contacts', j)
else:
self._log.info('Unsubscribe from %s', jid)
+ self._jids_for_auto_auth.discard(jid)
self._con.get_module('Roster').unsubscribe(jid)
self._con.get_module('Roster').set_item(jid)
@@ -330,7 +334,7 @@ class Presence(BaseModule):
self._log.info('Request Subscription to %s', jid)
if auto_auth:
- self.jids_for_auto_auth.append(jid)
+ self.jids_for_auto_auth.add(jid)
infos = {'jid': jid}
if name:
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/bc98b95c885ecd4fd903f54df0a3a748…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/bc98b95c885ecd4fd903f54df0a3a748…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
6ec7a686 by lovetox at 2020-04-01T22:13:19+02:00
TransformChatToMUC: Fix adding muc serice JID
Fixes #10044
- - - - -
1 changed file:
- gajim/dialogs.py
Changes:
=====================================
gajim/dialogs.py
=====================================
@@ -917,8 +917,11 @@ class TransformChatToMUC:
self.server_list_comboboxentry.add_attribute(cell, 'text', 0)
# get the muc server of our server
- if 'jabber' in app.connections[account].muc_jid:
- server_list.append(app.connections[account].muc_jid['jabber'])
+ con = app.connections[account]
+ service_jid = con.get_module('MUC').service_jid
+ if service_jid is not None:
+ server_list.append(str(service_jid))
+
# add servers or recently joined groupchats
recently_groupchat = app.config.get_per('accounts', account, 'recent_groupchats').split()
for g in recently_groupchat:
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/6ec7a686c9ace16359b1c523bd94519b…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/6ec7a686c9ace16359b1c523bd94519b…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
050985c6 by lovetox at 2020-04-01T19:17:45+02:00
Windows: Don't store password in keyring in portable mode
Otherwise its not really portable if it stores data in the system keyring
- - - - -
1 changed file:
- gajim/common/config.py
Changes:
=====================================
gajim/common/config.py
=====================================
@@ -689,6 +689,9 @@ class Config:
for opt in self.__options[0]:
self.__options[1][opt] = self.__options[0][opt][Option.VAL]
+ if gajim.IS_PORTABLE:
+ self.__options[1]['use_keyring'] = False
+
def _really_save(self):
from gajim.common import app
if app.interface:
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/050985c651e6d138b3d4743d970d2390…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/050985c651e6d138b3d4743d970d2390…
You're receiving this email because of your account on dev.gajim.org.