Daniel Brötzmann pushed to branch mainwindow at gajim / gajim


Commits:
c44cfda5 by wurstsalat at 2021-09-11T12:41:55+02:00
AddContact: Consider other services

- - - - -


2 changed files:

- gajim/data/gui/add_contact.ui
- gajim/gtk/add_contact.py


Changes:

=====================================
gajim/data/gui/add_contact.ui
=====================================
@@ -289,6 +289,8 @@
             <property name="visible">True</property>
             <property name="can-focus">False</property>
             <property name="wrap">True</property>
+            <property name="max-width-chars">50</property>
+            <property name="xalign">0</property>
             <style>
               <class name="bold16"/>
             </style>
@@ -326,8 +328,8 @@
           </packing>
         </child>
         <child>
-          <object class="GtkButton" id="command_button">
-            <property name="label" translatable="yes">Command</property>
+          <object class="GtkButton" id="commands_button">
+            <property name="label" translatable="yes">Show Commands</property>
             <property name="visible">True</property>
             <property name="can-focus">True</property>
             <property name="receives-default">True</property>


=====================================
gajim/gtk/add_contact.py
=====================================
@@ -149,7 +149,17 @@ def _process_info(self, account, result):
 
         if result.is_muc:
             for identity in result.identities:
+                if identity.type == 'text' and result.jid.is_domain:
+                    # It's a group chat component advertising
+                    # category 'conference'
+                    self.get_page('error').set_text(
+                        _('This address does not seem to offer any gateway '
+                          'service.'))
+                    self.show_page('error')
+                    return
+
                 if identity.type == 'irc' and result.jid.is_domain:
+                    # It's an IRC gateway advertising category 'conference'
                     self.get_page('gateway').prepare(account, result)
                     self.show_page(
                         'gateway', Gtk.StackTransitionType.SLIDE_LEFT)
@@ -167,6 +177,11 @@ def _process_info(self, account, result):
         if result.has_category('client'):
             self.get_page('contact').prepare(account, result)
             self.show_page('contact', Gtk.StackTransitionType.SLIDE_LEFT)
+            return
+
+        self.get_page('error').set_text(
+            _('This address does not seem to offer any gateway service.'))
+        self.show_page('error')
 
 
 class Address(Page):
@@ -355,7 +370,7 @@ def __init__(self):
         self.add(self._ui.gateway_box)
 
         self._ui.register_button.connect('clicked', self._on_register_clicked)
-        self._ui.command_button.connect('clicked', self._on_command_clicked)
+        self._ui.commands_button.connect('clicked', self._on_command_clicked)
 
         self.show_all()
 
@@ -403,11 +418,11 @@ def prepare(self, account, result):
                 _('This gateway does not support direct registering.'))
 
         if result.supports(Namespace.COMMANDS):
-            self._ui.command_button.set_sensitive(True)
-            self._ui.command_button.set_tooltip_text('')
+            self._ui.commands_button.set_sensitive(True)
+            self._ui.commands_button.set_tooltip_text('')
         else:
-            self._ui.command_button.set_sensitive(False)
-            self._ui.command_button.set_tooltip_text(
+            self._ui.commands_button.set_sensitive(False)
+            self._ui.commands_button.set_tooltip_text(
                 _('This gateway does not support Ad-Hoc Commands.'))
 
     def _on_register_clicked(self, _button):



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/c44cfda5eab2332f1570c7629e4844d871af6ac3

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/c44cfda5eab2332f1570c7629e4844d871af6ac3
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to