diff --git a/data/gajim-remote.1 b/data/gajim-remote.1
index d08b5765e..af5631723 100644
--- a/data/gajim-remote.1
+++ b/data/gajim-remote.1
@@ -19,8 +19,6 @@ by D-Bus.
.El
.Ss account_info Aq account
Gets detailed info on a account
-.Ss add_contact Ao jid Ac Bq account
-Adds contact to roster
.Ss change_avatar Ao picture Ac Bq account
Change the avatar
.Ss change_status Bo status Bc Bo message Bc Bq account
@@ -35,18 +33,12 @@ Returns current status (the global one unless account is specified)
Returns current status message (the global one unless account is specified)
.Ss get_unread_msgs_number
Returns number of unread messages
-.Ss handle_uri Ao uri Ac Bo account Bc Bq message
-Handle a xmpp:/ uri
.Ss help Bq command
Shows a help on specific command
-.Ss join_room Ao room Ac Bo nick Bc Bo password Bc Bq account
-Join a MUC room
.Ss list_accounts
Prints a list of registered accounts
.Ss list_contacts Bq account
Prints a list of all contacts in the roster. Each contact appears on a separate line
-.Ss open_chat Ao jid Ac Bo account Bc Bq message
-Shows the chat dialog so that you can send messages to a contact
.Ss prefs_del Aq key
Deletes a preference item
.Ss prefs_list
@@ -71,8 +63,6 @@ Sends custom XML
Changes the priority of account or accounts
.Ss show_next_pending_event
Pops up a window with the next pending event
-.Ss start_chat Aq account
-Opens 'Start Chat' dialog
.Ss toggle_ipython
Shows or hides the ipython window
.Ss toggle_roster_appearance
diff --git a/data/gajim-remote.desktop.in b/data/gajim-remote.desktop.in
index dcb8f8a4e..71d164539 100644
--- a/data/gajim-remote.desktop.in
+++ b/data/gajim-remote.desktop.in
@@ -9,5 +9,4 @@ TryExec=gajim-remote
StartupNotify=false
Terminal=false
Type=Application
-MimeType=x-scheme-handler/xmpp;
NoDisplay=true
diff --git a/data/org.gajim.Gajim.desktop.in b/data/org.gajim.Gajim.desktop.in
index 16f8fb99d..521e84334 100644
--- a/data/org.gajim.Gajim.desktop.in
+++ b/data/org.gajim.Gajim.desktop.in
@@ -13,3 +13,4 @@ StartupNotify=true
StartupWMClass=Gajim
Terminal=false
Type=Application
+MimeType=x-scheme-handler/xmpp;
diff --git a/gajim/app_actions.py b/gajim/app_actions.py
index 8b7ae5cb3..d32989993 100644
--- a/gajim/app_actions.py
+++ b/gajim/app_actions.py
@@ -18,14 +18,15 @@
## along with Gajim. If not, see .
##
+import sys
+import os
+
+from gi.repository import Gtk
+
from gajim.common import app
from gajim.common import helpers
from gajim.common.app import interface
from gajim.common.exceptions import GajimGeneralException
-from gi.repository import Gtk
-import sys
-import os
-
from gajim import config
from gajim import dialogs
from gajim import features_window
@@ -43,6 +44,11 @@ class AppActions():
def __init__(self, application: Gtk.Application):
self.application = application
+ # General Actions
+
+ def on_add_contact_jid(self, action, param):
+ dialogs.AddNewContactWindow(None, param.get_string())
+
# Application Menu Actions
def on_preferences(self, action, param):
@@ -74,6 +80,12 @@ class AppActions():
def on_quit(self, action, param):
interface.roster.on_quit_request()
+ def on_new_chat(self, action, param):
+ if 'start_chat' in app.interface.instances:
+ app.interface.instances['start_chat'].present()
+ else:
+ app.interface.instances['start_chat'] = dialogs.StartChatDialog()
+
# Accounts Actions
def on_profile(self, action, param):
@@ -116,20 +128,14 @@ class AppActions():
'You cannot join a group chat while you are invisible'))
return
if 'join_gc' in interface.instances[account]:
- interface.instances[account]['join_gc'].window.present()
+ interface.instances[account]['join_gc'].present()
else:
- try:
- interface.instances[account]['join_gc'] = \
- dialogs.JoinGroupchatWindow(account)
- except GajimGeneralException:
- pass
+ interface.instances[account]['join_gc'] = \
+ dialogs.JoinGroupchatWindow(account, None)
def on_add_contact(self, action, param):
dialogs.AddNewContactWindow(param.get_string())
- def on_new_chat(self, action, param):
- dialogs.NewChatDialog(param.get_string())
-
def on_single_message(self, action, param):
dialogs.SingleMessageWindow(param.get_string(), action='send')
diff --git a/gajim/chat_control.py b/gajim/chat_control.py
index 9442e19a2..a677fc5cf 100644
--- a/gajim/chat_control.py
+++ b/gajim/chat_control.py
@@ -1601,15 +1601,13 @@ class ChatControl(ChatControlBase):
self._add_info_bar_message(markup, [b], file_props, Gtk.MessageType.ERROR)
def _on_accept_gc_invitation(self, widget, event):
- try:
- if event.is_continued:
- app.interface.join_gc_room(self.account, event.room_jid,
- app.nicks[self.account], event.password,
- is_continued=True)
- else:
- dialogs.JoinGroupchatWindow(self.account, event.room_jid)
- except GajimGeneralException:
- pass
+ if event.is_continued:
+ app.interface.join_gc_room(self.account, event.room_jid,
+ app.nicks[self.account], event.password,
+ is_continued=True)
+ else:
+ app.interface.join_gc_minimal(self.account, event.room_jid)
+
app.events.remove_events(self.account, self.contact.jid, event=event)
def _on_cancel_gc_invitation(self, widget, event):
diff --git a/gajim/command_system/implementation/standard.py b/gajim/command_system/implementation/standard.py
index 0d96cc30f..059be9fae 100644
--- a/gajim/command_system/implementation/standard.py
+++ b/gajim/command_system/implementation/standard.py
@@ -296,21 +296,12 @@ class StandardGroupChatCommands(CommandContainer):
'room_jid': self.room_jid}
@command(raw=True, empty=True)
- @doc(_("Join a group chat given by a jid, optionally using given nickname"))
- def join(self, jid, nick):
- if not nick:
- nick = self.nick
-
+ @doc(_("Join a group chat given by a jid"))
+ def join(self, jid):
if '@' not in jid:
jid = jid + '@' + app.get_server_from_jid(self.room_jid)
- try:
- app.interface.instances[self.account]['join_gc'].window.present()
- except KeyError:
- try:
- dialogs.JoinGroupchatWindow(account=self.account, room_jid=jid, nick=nick)
- except GajimGeneralException:
- pass
+ app.interface.join_gc_minimal(self.account, room_jid=jid)
@command('part', 'close', raw=True, empty=True)
@doc(_("Leave the groupchat, optionally giving a reason, and close tab or window"))
diff --git a/gajim/common/app.py b/gajim/common/app.py
index 010117a36..0a2e60632 100644
--- a/gajim/common/app.py
+++ b/gajim/common/app.py
@@ -33,6 +33,7 @@ import logging
import locale
import uuid
from distutils.version import LooseVersion as V
+from collections import namedtuple
import gi
import nbxmpp
import hashlib
@@ -81,6 +82,8 @@ PLUGINS_DIRS = [gajimpaths['PLUGINS_BASE'],
PLUGINS_CONFIG_DIR = gajimpaths['PLUGINS_CONFIG_DIR']
MY_CERT_DIR = gajimpaths['MY_CERT']
+RecentGroupchat = namedtuple('RecentGroupchat', ['room', 'server', 'nickname'])
+
try:
LANG = locale.getdefaultlocale()[0] # en_US, fr_FR, el_GR etc..
except (ValueError, locale.Error):
@@ -373,6 +376,16 @@ def get_number_of_connected_accounts(accounts_list = None):
connected_accounts = connected_accounts + 1
return connected_accounts
+def get_connected_accounts():
+ """
+ Returns a list of CONNECTED accounts
+ """
+ account_list = []
+ for account in connections:
+ if account_is_connected(account):
+ account_list.append(account)
+ return account_list
+
def account_is_connected(account):
if account not in connections:
return False
@@ -388,6 +401,11 @@ def zeroconf_is_connected():
return account_is_connected(ZEROCONF_ACC_NAME) and \
config.get_per('accounts', ZEROCONF_ACC_NAME, 'is_zeroconf')
+def in_groupchat(account, room_jid):
+ if room_jid not in gc_connected[account]:
+ return False
+ return gc_connected[account][room_jid]
+
def get_number_of_securely_connected_accounts():
"""
Return the number of the accounts that are SSL/TLS connected
@@ -495,6 +513,34 @@ def get_name_from_jid(account, jid):
actor = jid
return actor
+def get_muc_domain(account):
+ return connections[account].muc_jid.get('jabber', None)
+
+def get_recent_groupchats(account):
+ recent_groupchats = config.get_per(
+ 'accounts', account, 'recent_groupchats').split()
+
+ recent_list = []
+ for groupchat in recent_groupchats:
+ jid = nbxmpp.JID(groupchat)
+ recent = RecentGroupchat(
+ jid.getNode(), jid.getDomain(), jid.getResource())
+ recent_list.append(recent)
+ return recent_list
+
+def add_recent_groupchat(account, room_jid, nickname):
+ recent = config.get_per(
+ 'accounts', account, 'recent_groupchats').split()
+ full_jid = room_jid + '/' + nickname
+ if full_jid in recent:
+ recent.remove(full_jid)
+ recent.insert(0, full_jid)
+ if len(recent) > 10:
+ recent = recent[0:9]
+ config_value = ' '.join(recent)
+ config.set_per(
+ 'accounts', account, 'recent_groupchats', config_value)
+
def get_priority(account, show):
"""
Return the priority an account must have
diff --git a/gajim/common/caps_cache.py b/gajim/common/caps_cache.py
index 957633f7d..b0975067c 100644
--- a/gajim/common/caps_cache.py
+++ b/gajim/common/caps_cache.py
@@ -472,6 +472,10 @@ class MucCapsCache:
if child.getNamespace() == nbxmpp.NS_DATA:
data.append(nbxmpp.DataForm(node=child))
+ if nbxmpp.NS_MUC not in features:
+ # Not a MUC, dont cache info
+ return
+
self.cache[jid] = self.DiscoInfo(identities, features, data)
def is_cached(self, jid):
diff --git a/gajim/common/config.py b/gajim/common/config.py
index 258df8afe..e2148448c 100644
--- a/gajim/common/config.py
+++ b/gajim/common/config.py
@@ -174,7 +174,6 @@ class Config:
'history_window_x-position': [ opt_int, 0 ],
'history_window_y-position': [ opt_int, 0 ],
'latest_disco_addresses': [ opt_str, '' ],
- 'recently_groupchat': [ opt_str, '' ],
'time_stamp': [ opt_str, '[%X] ', _('This option let you customize timestamp that is printed in conversation. For exemple "[%H:%M] " will show "[hour:minute] ". See python doc on strftime for full documentation: http://docs.python.org/lib/module-time.html') ],
'before_nickname': [ opt_str, '', _('Characters that are printed before the nickname in conversations') ],
'after_nickname': [ opt_str, ':', _('Characters that are printed after the nickname in conversations') ],
@@ -409,6 +408,7 @@ class Config:
'oauth2_client_id': [ opt_str, '0000000044077801', _('client_id for OAuth 2.0 authentication.')],
'oauth2_redirect_url': [ opt_str, 'https%3A%2F%2Fgajim.org%2Fmsnauth%2Findex.cgi', _('redirect_url for OAuth 2.0 authentication.')],
'opened_chat_controls': [opt_str, '', _('Space separated list of JIDs for which we want to re-open a chat window on next startup.')],
+ 'recent_groupchats': [ opt_str, '' ],
}, {}),
'statusmsg': ({
'message': [ opt_str, '' ],
diff --git a/gajim/common/connection_handlers.py b/gajim/common/connection_handlers.py
index 01180fc98..5ac99fc48 100644
--- a/gajim/common/connection_handlers.py
+++ b/gajim/common/connection_handlers.py
@@ -98,6 +98,9 @@ class ConnectionDisco:
self.disco_info_ids.append(id_)
def discoverMUC(self, jid, callback):
+ if muc_caps_cache.is_cached(jid):
+ callback()
+ return
disco_info = nbxmpp.Iq(typ='get', to=jid, queryNS=nbxmpp.NS_DISCO_INFO)
self.connection.SendAndCallForResponse(
disco_info, self.received_muc_info, {'callback': callback})
diff --git a/gajim/common/helpers.py b/gajim/common/helpers.py
index 06142f5fd..51eca6afa 100644
--- a/gajim/common/helpers.py
+++ b/gajim/common/helpers.py
@@ -411,6 +411,16 @@ def get_uf_show(show, use_mnemonic = False):
uf_show = Q_('?contact has status:Has errors')
return uf_show
+def get_css_show_color(show):
+ if show in ('online', 'chat', 'invisible'):
+ return 'status-online'
+ elif show in ('offline', 'not in roster', 'requested'):
+ return None
+ elif show in ('xa', 'dnd'):
+ return 'status-dnd'
+ elif show in ('away'):
+ return 'status-away'
+
def get_uf_sub(sub):
if sub == 'none':
uf_sub = Q_('?Subscription we already have:None')
diff --git a/gajim/conversation_textview.py b/gajim/conversation_textview.py
index 721306d93..f1968f88d 100644
--- a/gajim/conversation_textview.py
+++ b/gajim/conversation_textview.py
@@ -689,15 +689,9 @@ class ConversationTextview(GObject.GObject):
app.interface.new_chat_from_jid(self.account, jid)
def on_join_group_chat_menuitem_activate(self, widget, room_jid):
- if 'join_gc' in app.interface.instances[self.account]:
- instance = app.interface.instances[self.account]['join_gc']
- instance.xml.get_object('room_jid_entry').set_text(room_jid)
- app.interface.instances[self.account]['join_gc'].window.present()
- else:
- try:
- dialogs.JoinGroupchatWindow(account=self.account, room_jid=room_jid)
- except GajimGeneralException:
- pass
+ # Remove ?join
+ room_jid = room_jid.split('?')[0]
+ app.interface.join_gc_minimal(self.account, room_jid)
def on_add_to_roster_activate(self, widget, jid):
dialogs.AddNewContactWindow(self.account, jid)
@@ -805,7 +799,7 @@ class ConversationTextview(GObject.GObject):
if '?' in word:
(jid, action) = word.split('?')
if action == 'join':
- self.on_join_group_chat_menuitem_activate(None, jid)
+ app.interface.join_gc_minimal(None, jid)
else:
self.on_start_chat_activate(None, jid)
else:
diff --git a/gajim/data/gui/account_context_menu.ui b/gajim/data/gui/account_context_menu.ui
index 665f54d80..333804447 100644
--- a/gajim/data/gui/account_context_menu.ui
+++ b/gajim/data/gui/account_context_menu.ui
@@ -28,15 +28,6 @@
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-
-
-