Philipp Hörist pushed to branch master at gajim / gajim
Commits: 141bb011 by Philipp Hörist at 2020-01-23T19:16:35+01:00 Adapt to nbxmpp callback signature changes
The Client instance is now always the first argument
- - - - -
19 changed files:
- gajim/common/connection.py - gajim/common/modules/adhoc_commands.py - gajim/common/modules/bits_of_binary.py - gajim/common/modules/delimiter.py - gajim/common/modules/entity_time.py - gajim/common/modules/gateway.py - gajim/common/modules/mam.py - gajim/common/modules/metacontacts.py - gajim/common/modules/ping.py - gajim/common/modules/privacylists.py - gajim/common/modules/pubsub.py - gajim/common/modules/register.py - gajim/common/modules/roster.py - gajim/common/modules/search.py - gajim/common/modules/security_labels.py - gajim/common/modules/vcard_temp.py - gajim/common/proxy65_manager.py - gajim/gtk/discovery.py - gajim/gtk/server_info.py
Changes:
===================================== gajim/common/connection.py ===================================== @@ -678,7 +678,7 @@ class Connection(CommonConnection, ConnectionHandlers): if data[4] != '': helpers.replace_dataform_media(conf, data[4]) if self.new_account_form: - def _on_register_result(result): + def _on_register_result(_nbxmpp_client, result): if not nbxmpp.isResultNode(result): reason = result.getErrorMsg() or result.getError() app.nec.push_incoming_event(NetworkEvent( @@ -1362,7 +1362,7 @@ class Connection(CommonConnection, ConnectionHandlers): msg=msg, initial=initial)
- def _continue_invisible(self, con, iq_obj, msg, signed, initial): + def _continue_invisible(self, _nbxmpp_client, iq_obj, msg, signed, initial): if iq_obj.getType() == 'error': # server doesn't support privacy lists return # active the privacy rule
===================================== gajim/common/modules/adhoc_commands.py ===================================== @@ -383,7 +383,7 @@ class AdHocCommands(BaseModule): self._con.connection.SendAndCallForResponse( stanza, self._action_response_received)
- def _action_response_received(self, stanza): + def _action_response_received(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.info('Error: %s', stanza.getError())
@@ -413,7 +413,7 @@ class AdHocCommands(BaseModule): self._con.connection.SendAndCallForResponse( stanza, self._cancel_result_received)
- def _cancel_result_received(self, stanza): + def _cancel_result_received(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.warning('Error: %s', stanza.getError()) else:
===================================== gajim/common/modules/bits_of_binary.py ===================================== @@ -52,7 +52,7 @@ class BitsOfBinary(BaseModule): self._con.connection.send(iq) raise nbxmpp.NodeProcessed
- def _on_bob_received(self, _con, result, cid): + def _on_bob_received(self, _nbxmpp_client, result, cid): """ Called when we receive BoB data """
===================================== gajim/common/modules/delimiter.py ===================================== @@ -33,7 +33,7 @@ class Delimiter(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._delimiter_received)
- def _delimiter_received(self, stanza): + def _delimiter_received(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.info('Request error: %s', stanza.getError()) else: @@ -56,7 +56,7 @@ class Delimiter(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._set_delimiter_response)
- def _set_delimiter_response(self, stanza): + def _set_delimiter_response(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.info('Store error: %s', stanza.getError())
===================================== gajim/common/modules/entity_time.py ===================================== @@ -53,7 +53,7 @@ class EntityTime(BaseModule):
self._con.connection.SendAndCallForResponse(iq, self._result_received)
- def _result_received(self, stanza): + def _result_received(self, _nbxmpp_client, stanza): time_info = None if not nbxmpp.isResultNode(stanza): self._log.info('Error: %s', stanza.getError())
===================================== gajim/common/modules/gateway.py ===================================== @@ -35,7 +35,7 @@ class Gateway(BaseModule): iq, self._on_unsubscribe_result) self._con.get_module('Roster').del_item(agent)
- def _on_unsubscribe_result(self, stanza): + def _on_unsubscribe_result(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.info('Error: %s', stanza.getError()) return @@ -69,7 +69,7 @@ class Gateway(BaseModule): query.setTagData('prompt', prompt) self._con.connection.SendAndCallForResponse(iq, self._on_prompt_result)
- def _on_prompt_result(self, stanza): + def _on_prompt_result(self, _nbxmpp_client, stanza): jid = str(stanza.getFrom()) fjid = stanza.getFrom().getBare() resource = stanza.getFrom().getResource()
===================================== gajim/common/modules/mam.py ===================================== @@ -297,7 +297,7 @@ class MAM(BaseModule): query, self._received_count, {'query_id': query_id}) return query_id
- def _received_count(self, _con, stanza, query_id): + def _received_count(self, _nbxmpp_client, stanza, query_id): try: _, set_ = self._parse_iq(stanza) except InvalidMamIQ: @@ -402,7 +402,7 @@ class MAM(BaseModule): 'start_date': start_date, 'groupchat': groupchat})
- def _result_finished(self, _con, stanza, query_id, start_date, groupchat): + def _result_finished(self, _nbxmpp_client, stanza, query_id, start_date, groupchat): try: fin, set_ = self._parse_iq(stanza) except InvalidMamIQ: @@ -458,7 +458,7 @@ class MAM(BaseModule): 'end_date': end_date}) return query_id
- def _intervall_result(self, _con, stanza, query_id, + def _intervall_result(self, _nbxmpp_client, stanza, query_id, start_date, end_date): try: fin, set_ = self._parse_iq(stanza) @@ -539,7 +539,7 @@ class MAM(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._preferences_received)
- def _preferences_received(self, stanza): + def _preferences_received(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.info('Error: %s', stanza.getError()) app.nec.push_incoming_event(MAMPreferenceError( @@ -580,7 +580,7 @@ class MAM(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._preferences_saved)
- def _preferences_saved(self, stanza): + def _preferences_saved(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.info('Error: %s', stanza.getError()) app.nec.push_incoming_event(MAMPreferenceError(
===================================== gajim/common/modules/metacontacts.py ===================================== @@ -36,7 +36,7 @@ class MetaContacts(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._metacontacts_received)
- def _metacontacts_received(self, stanza): + def _metacontacts_received(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.info('Request error: %s', stanza.getError()) else: @@ -93,7 +93,7 @@ class MetaContacts(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._store_response_received)
- def _store_response_received(self, stanza): + def _store_response_received(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.info('Store error: %s', stanza.getError())
===================================== gajim/common/modules/ping.py ===================================== @@ -62,7 +62,9 @@ class Ping(BaseModule): self._con.connection.SendAndCallForResponse(self._get_ping_iq(to), self._keepalive_received)
- def _keepalive_received(self, _stanza: nbxmpp.Iq) -> None: + def _keepalive_received(self, + _nbxmpp_client: Any, + _stanza: nbxmpp.Iq) -> None: self._log.info('Received keepalive') self.remove_timeout()
@@ -91,7 +93,7 @@ class Ping(BaseModule): PingSentEvent(None, conn=self._con, contact=contact))
def _pong_received(self, - _con: ConnectionT, + _nbxmpp_client: Any, stanza: nbxmpp.Iq, ping_time: int, contact: ContactsT) -> None:
===================================== gajim/common/modules/privacylists.py ===================================== @@ -76,7 +76,7 @@ class PrivacyLists(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._privacy_lists_received, {'callback': callback})
- def _privacy_lists_received(self, _con, stanza, callback): + def _privacy_lists_received(self, _nbxmpp_client, stanza, callback): lists = [] new_default = None result = nbxmpp.isResultNode(stanza) @@ -118,7 +118,7 @@ class PrivacyLists(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._privacy_list_received)
- def _privacy_list_received(self, stanza): + def _privacy_list_received(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.warning('List not available: %s', stanza.getError()) return @@ -152,7 +152,7 @@ class PrivacyLists(BaseModule): def del_privacy_list(self, name): self._log.info('Remove list: %s', name)
- def _del_privacy_list_result(stanza): + def _del_privacy_list_result(_nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.warning('List deletion failed: %s', stanza.getError()) app.nec.push_incoming_event(InformationEvent( @@ -235,7 +235,7 @@ class PrivacyLists(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._default_result_handler, {})
- def _default_result_handler(self, _con, stanza): + def _default_result_handler(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.warning('Operation failed: %s', stanza.getError())
===================================== gajim/common/modules/pubsub.py ===================================== @@ -164,7 +164,7 @@ class PubSub(BaseModule): pubsub = query.addChild('pubsub', namespace=nbxmpp.NS_PUBSUB_OWNER) pubsub.addChild('delete', {'node': node})
- def response(_con, resp, jid, node): + def response(_nbxmpp_client, resp, jid, node): if resp.getType() == 'result' and on_ok: on_ok(jid, node) elif on_fail: @@ -218,7 +218,7 @@ class PubSub(BaseModule): self._con.connection.SendAndCallForResponse( query, self._received_pb_configuration, {'node': node})
- def _received_pb_configuration(self, _con, stanza, node): + def _received_pb_configuration(self, _nbxmpp_client, stanza, node): if not nbxmpp.isResultNode(stanza): self._log.warning('Error: %s', stanza.getError()) return
===================================== gajim/common/modules/register.py ===================================== @@ -46,7 +46,8 @@ class Register(BaseModule): iq, self._change_password_response, {'success_cb': weak_success_cb, 'error_cb': weak_error_cb})
- def _change_password_response(self, _con, stanza, success_cb, error_cb): + def _change_password_response(self, _nbxmpp_client, stanza, + success_cb, error_cb): if not nbxmpp.isResultNode(stanza): error = stanza.getErrorMsg() self._log.info('Error: %s', error) @@ -81,7 +82,7 @@ class Register(BaseModule): self.agent_registrations[agent] = {'roster_push': False, 'sub_received': False}
- def _register_agent_response(self, _con, stanza, agent, + def _register_agent_response(self, _nbxmpp_client, stanza, agent, success_cb, error_cb): if not nbxmpp.isResultNode(stanza): error = stanza.getErrorMsg() @@ -114,7 +115,8 @@ class Register(BaseModule): iq, self._register_info_response, {'success_cb': weak_success_cb, 'error_cb': weak_error_cb})
- def _register_info_response(self, _con, stanza, success_cb, error_cb): + def _register_info_response(self, _nbxmpp_client, stanza, + success_cb, error_cb): if not nbxmpp.isResultNode(stanza): error = stanza.getErrorMsg() self._log.info('Error: %s', error)
===================================== gajim/common/modules/roster.py ===================================== @@ -84,7 +84,7 @@ class Roster(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._roster_received)
- def _roster_received(self, stanza): + def _roster_received(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.warning('Unable to retrive roster: %s', stanza.getError()) else:
===================================== gajim/common/modules/search.py ===================================== @@ -30,7 +30,7 @@ class Search(BaseModule): iq = nbxmpp.Iq(typ='get', to=jid, queryNS=nbxmpp.NS_SEARCH) self._con.connection.SendAndCallForResponse(iq, self._fields_received)
- def _fields_received(self, stanza): + def _fields_received(self, _nbxmpp_client, stanza): data = None is_dataform = False
@@ -67,7 +67,7 @@ class Search(BaseModule):
self._con.connection.SendAndCallForResponse(iq, self._received_result)
- def _received_result(self, stanza): + def _received_result(self, _nbxmpp_client, stanza): data = None is_dataform = False
===================================== gajim/common/modules/security_labels.py ===================================== @@ -45,7 +45,7 @@ class SecLabels(BaseModule): self._con.connection.SendAndCallForResponse( iq, self._catalog_received)
- def _catalog_received(self, stanza): + def _catalog_received(self, _nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): self._log.info('Error: %s', stanza.getError()) return
===================================== gajim/common/modules/vcard_temp.py ===================================== @@ -135,13 +135,13 @@ class VCardTemp(BaseModule): iq, self._upload_room_avatar_result)
@staticmethod - def _upload_room_avatar_result(stanza): + def _upload_room_avatar_result(_nbxmpp_client, stanza): if not nbxmpp.isResultNode(stanza): reason = stanza.getErrorMsg() or stanza.getError() app.nec.push_incoming_event(InformationEvent( None, dialog_name='avatar-upload-error', args=reason))
- def _avatar_publish_result(self, _con, stanza, sha): + def _avatar_publish_result(self, _nbxmpp_client, stanza, sha): if stanza.getType() == 'result': current_sha = app.config.get_per( 'accounts', self._account, 'avatar_sha') @@ -185,7 +185,7 @@ class VCardTemp(BaseModule):
return avatar_sha, photo_decoded
- def _parse_vcard(self, _con, stanza, callback, expected_sha): + def _parse_vcard(self, _nbxmpp_client, stanza, callback, expected_sha): frm_jid = stanza.getFrom() room = False if frm_jid is None:
===================================== gajim/common/proxy65_manager.py ===================================== @@ -156,7 +156,7 @@ class ProxyResolver: else: self.state = S_INITIAL
- def _result_received(self, data): + def _result_received(self, _nbxmpp_client, data): self.disconnect(self.active_connection) if data.getType() == 'result': self.keep_conf()
===================================== gajim/gtk/discovery.py ===================================== @@ -2079,7 +2079,7 @@ class DiscussionGroupsBrowser(AgentBrowser): con.get_module('PubSub').send_pb_unsubscribe( self.jid, node, self._on_pep_unsubscribe, groupnode=node)
- def _on_pep_subscriptions(self, conn, request): + def _on_pep_subscriptions(self, _nbxmpp_client, request): """ We got the subscribed groups list stanza. Now, if we already have items on the list, we should actualize them @@ -2108,7 +2108,7 @@ class DiscussionGroupsBrowser(AgentBrowser): # we now know subscriptions, update button states self.update_actions()
- def _on_pep_subscribe(self, conn, request, groupnode): + def _on_pep_subscribe(self, _nbxmpp_client, request, groupnode): """ We have just subscribed to a node. Update UI """ @@ -2122,7 +2122,7 @@ class DiscussionGroupsBrowser(AgentBrowser):
self.update_actions()
- def _on_pep_unsubscribe(self, conn, request, groupnode): + def _on_pep_unsubscribe(self, _nbxmpp_client, request, groupnode): """ We have just unsubscribed from a node. Update UI """
===================================== gajim/gtk/server_info.py ===================================== @@ -219,7 +219,7 @@ class ServerInfo(Gtk.ApplicationWindow, EventHelper): open_uri(label.get_text(), account=self.account) return Gdk.EVENT_STOP
- def _on_last_activity(self, stanza): + def _on_last_activity(self, _nbxmpp_client, stanza): if self._destroyed: # Window got closed in the meantime return
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/141bb011fa9c06eb64253eb13d88f867caa...