From 358302fed3250f309c262e2e984b8313768490c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 20 Nov 2018 16:11:03 +0100 Subject: [PATCH] Remove chatstates plugin The functionality is implemented in Gajim --- chatstate/__init__.py | 1 - chatstate/chatstate.png | Bin 327 -> 0 bytes chatstate/chatstate.py | 112 ---------------------------------------- chatstate/manifest.ini | 11 ---- 4 files changed, 124 deletions(-) delete mode 100644 chatstate/__init__.py delete mode 100644 chatstate/chatstate.png delete mode 100644 chatstate/chatstate.py delete mode 100644 chatstate/manifest.ini diff --git a/chatstate/__init__.py b/chatstate/__init__.py deleted file mode 100644 index 46280c9..0000000 --- a/chatstate/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .chatstate import ChatstatePlugin diff --git a/chatstate/chatstate.png b/chatstate/chatstate.png deleted file mode 100644 index f17a892d6f5083ec9e0aa1fe280843e0cee02907..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 327 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)0`F@aHzA7eEot0*}aI z1_o|n5N2eUHAey{$X?><>&kwILzq+8^l@c%6;SAkr;B5V#p$Dy7jhj65NX?=+jQuu zm3*RO4dddAX~HEDM>1rx3?jcV9bTr*CfOn3`ayP!WKFN-HQn!rB-oxe+1Jd8es}y~ zd-9Kc{xd@uWR4dyid$%PaW(|X9Iw5-?QG8j7758ScYZVKY<)1}H;;kFrh|@w7HX=C zS(6{EQrkbp!gEr1_^Dm2Zy0aAzNs2~!~I>{g^Nudr>a;xw)}j@x>rg1jmUrPLasYk z{;WJwIZI7faS6+|)z6kO&M96R=^(m7bKZdfZYRYjOdQ5V-)HmoY`Pw?>xj8$n8y9X TcaGly`j5fW)z4*}Q$iB}k{Es= diff --git a/chatstate/chatstate.py b/chatstate/chatstate.py deleted file mode 100644 index a9da7a1..0000000 --- a/chatstate/chatstate.py +++ /dev/null @@ -1,112 +0,0 @@ -import unicodedata - -from gi.repository import GObject - -from gajim.plugins import GajimPlugin -from gajim.plugins.helpers import log_calls -from gajim.common import ged -from gajim.common import app -from gajim.common import helpers -from gajim import gtkgui_helpers - -# Since Gajim 1.1.0 _() has to be imported -try: - from gajim.common.i18n import _ -except ImportError: - pass - -def paragraph_direction_mark(text): - """ - Determine paragraph writing direction according to - http://www.unicode.org/reports/tr9/#The_Paragraph_Level - - Returns either Unicode LTR mark or RTL mark. - """ - for char in text: - bidi = unicodedata.bidirectional(char) - if bidi == 'L': - return '\u200E' - elif bidi == 'AL' or bidi == 'R': - return '\u200F' - - return '\u200E' - -class ChatstatePlugin(GajimPlugin): - - @log_calls('ChatstatePlugin') - def init(self): - self.description = _('Chat State Notifications in roster.' -'Font color of the contact varies depending on the chat state.\n' -'The plugin does not work if you use custom font color for contacts in roster.\n' -'https://dev.gajim.org/gajim/gajim/issues/3628\nhttp://xmpp.org/extensions/xep-0085.html') - self.config_dialog = None # ChatstatePluginConfigDialog(self) - self.events_handlers = {'chatstate-received': - (ged.GUI2, self.chatstate_received), } - self.active = None - - def chatstate_received(self, obj): - if not self.active: - return - - contact = app.contacts.get_contact_from_full_jid(obj.conn.name, - obj.fjid) - if not contact: - return - - chatstate = obj.chatstate - if chatstate not in self.chatstates.keys(): - return - - self.model = app.interface.roster.model - child_iters = app.interface.roster._get_contact_iter(obj.jid, - obj.conn.name, contact, self.model) - - name = GObject.markup_escape_text(contact.get_shown_name()) - contact_instances = app.contacts.get_contacts(obj.conn.name, - contact.jid) - - # Show resource counter - nb_connected_contact = 0 - for c in contact_instances: - if c.show not in ('error', 'offline'): - nb_connected_contact += 1 - if nb_connected_contact > 1: - name += paragraph_direction_mark(name) - name += ' (%d)' % nb_connected_contact - - for child_iter in child_iters: - if chatstate != 'gone': - color = self.chatstates[chatstate] - name = '%s' % (color, name) - if contact.status and app.config.get( - 'show_status_msgs_in_roster'): - status = contact.status.strip() - if status != '': - status = helpers.reduce_chars_newlines(status, - max_lines=1) - name += '\n%s' % (self.status_color, - GObject.markup_escape_text(status)) - self.model[child_iter][1] = name - - @log_calls('ChatstatePlugin') - def activate(self): - color = gtkgui_helpers.get_fade_color(app.interface.roster.tree, - False, False) - self.status_color = '#%02x%02x%02x' % (int(color.red * 255), - int(color.green * 255), - int(color.blue * 255)) - theme = app.config.get('roster_theme') - self.chatstates = {'active': app.config.get('inmsgcolor'), - 'composing': app.config.get_per('themes', theme, - 'state_composing_color'), - 'inactive': app.config.get_per('themes', theme, - 'state_inactive_color'), - 'paused': app.config.get_per('themes', theme, - 'state_paused_color'), - 'gone': None, } - self.active = True - - @log_calls('ChatstatePlugin') - def deactivate(self): - self.active = False diff --git a/chatstate/manifest.ini b/chatstate/manifest.ini deleted file mode 100644 index b64a400..0000000 --- a/chatstate/manifest.ini +++ /dev/null @@ -1,11 +0,0 @@ -[info] -name: Chatstate in roster -short_name: chatstate -version: 1.2.0 -description: Chat State Notifications in roster. - Font color of the contact varies depending on the chat state. - The plugin does not work if you use custom font color for contacts in roster. -authors: Denis Fomin -homepage: https://dev.gajim.org/gajim/gajim-plugins/wikis/ChatstatePlugin -min_gajim_version: 1.1.91 -max_gajim_version: 1.2.90