Commit 358302fe authored by Philipp Hörist's avatar Philipp Hörist

Remove chatstates plugin

The functionality is implemented in Gajim
parent 1ba6c872
from .chatstate import ChatstatePlugin
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
from gajim.common.i18n import _
except ImportError:
def paragraph_direction_mark(text):
Determine paragraph writing direction according to
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):
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'
self.config_dialog = None # ChatstatePluginConfigDialog(self)
self.events_handlers = {'chatstate-received':
(ged.GUI2, self.chatstate_received), } = None
def chatstate_received(self, obj):
if not
contact = app.contacts.get_contact_from_full_jid(,
if not contact:
chatstate = obj.chatstate
if chatstate not in self.chatstates.keys():
self.model = app.interface.roster.model
child_iters = app.interface.roster._get_contact_iter(obj.jid,, contact, self.model)
name = GObject.markup_escape_text(contact.get_shown_name())
contact_instances = app.contacts.get_contacts(,
# Show resource counter
nb_connected_contact = 0
for c in contact_instances:
if 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 = '<span foreground="%s">%s</span>' % (color, name)
if contact.status and app.config.get(
status = contact.status.strip()
if status != '':
status = helpers.reduce_chars_newlines(status,
name += '\n<span size="small" style="italic" ' \
'foreground="%s">%s</span>' % (self.status_color,
self.model[child_iter][1] = name
def activate(self):
color = gtkgui_helpers.get_fade_color(app.interface.roster.tree,
False, False)
self.status_color = '#%02x%02x%02x' % (int( * 255),
int( * 255),
int( * 255))
theme = app.config.get('roster_theme')
self.chatstates = {'active': app.config.get('inmsgcolor'),
'composing': app.config.get_per('themes', theme,
'inactive': app.config.get_per('themes', theme,
'paused': app.config.get_per('themes', theme,
'gone': None, } = True
def deactivate(self): = False
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 <>
min_gajim_version: 1.1.91
max_gajim_version: 1.2.90
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment