Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
03915f1e by lovetox at 2020-04-06T23:04:49+02:00
SM: Correctly set delay from attribute
- - - - -
1 changed file:
- nbxmpp/smacks.py
Changes:
=====================================
nbxmpp/smacks.py
=====================================
@@ -132,7 +132,7 @@ class Smacks:
attrs = {'stamp': timestamp}
if stanza.getType() != 'groupchat':
# Dont leak our JID to Groupchats
- attrs['from'] = stanza.getAttr('from')
+ attrs['from'] = str(self._client.get_bound_jid())
stanza.addChild('delay', namespace=NS_DELAY2, attrs=attrs)
self._uqueue.append(stanza)
self._log.debug('OUT, %s', stanza.getName())
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/03915f1efe9bb11623530cc7…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/03915f1efe9bb11623530cc7…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
d6596632 by lovetox at 2020-04-06T19:13:13+02:00
Be more strict with websocket uri detection
- - - - -
2 changed files:
- gajim/common/helpers.py
- gajim/gtk/account_wizard.py
Changes:
=====================================
gajim/common/helpers.py
=====================================
@@ -1754,7 +1754,7 @@ def get_custom_host(account):
type_ = app.config.get_per('accounts', account, 'custom_type')
protocol = ConnectionProtocol.TCP
- if host.startswith('ws'):
+ if host.startswith('ws://') or host.startswith('wss://'):
protocol = ConnectionProtocol.WEBSOCKET
return ('%s:%s' % (host, port),
=====================================
gajim/gtk/account_wizard.py
=====================================
@@ -699,7 +699,7 @@ class AdvancedSettings(Page):
con_type = self._ui.con_type_combo.get_active_text()
protocol = ConnectionProtocol.TCP
- if host.startswith('ws'):
+ if host.startswith('ws://') or host.startswith('wss://'):
protocol = ConnectionProtocol.WEBSOCKET
return ('%s:%s' % (host, port),
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/d6596632557ebeffe525a64b91959d53…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/d6596632557ebeffe525a64b91959d53…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
6b44e6d6 by lovetox at 2020-04-06T06:59:56+02:00
Jingle: Fix invalid IQ error type
- - - - -
1 changed file:
- gajim/common/jingle_session.py
Changes:
=====================================
gajim/common/jingle_session.py
=====================================
@@ -588,7 +588,7 @@ class JingleSession:
creator = content['creator']
if (creator, name) not in self.contents:
text = 'Content %s (created by %s) does not exist' % (name, creator)
- self.__send_error(stanza, 'bad-request', text=text, type_='_modify')
+ self.__send_error(stanza, 'bad-request', text=text, type_='modify')
raise nbxmpp.NodeProcessed
cn = self.contents[(creator, name)]
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/6b44e6d6c833c810fbe1aca084b4888a…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/6b44e6d6c833c810fbe1aca084b4888a…
You're receiving this email because of your account on dev.gajim.org.
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.