Skip to content
Snippets Groups Projects
Commit ea470f89 authored by Dicson's avatar Dicson
Browse files

chatstate.Show resource counter

parent 0f3e7d20
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,23 @@ from common import ged
from common import gajim
from common import helpers
import gtkgui_helpers
import unicodedata
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 u'\u200E'
elif bidi == 'AL' or bidi == 'R':
return u'\u200F'
return u'\u200E'
class ChatstatePlugin(GajimPlugin):
......@@ -41,12 +57,23 @@ class ChatstatePlugin(GajimPlugin):
child_iters = gajim.interface.roster._get_contact_iter(obj.jid,
obj.conn.name, contact, self.model)
name = gobject.markup_escape_text(contact.get_shown_name())
contact_instances = gajim.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(unicode(name))
name += u' (%d)' % nb_connected_contact
for child_iter in child_iters:
name = gobject.markup_escape_text(contact.get_shown_name())
if chatstate != 'gone':
color = self.chatstates[chatstate]
name = '<span foreground="%s">%s</span>' % (color, name)
if contact.status and gajim.config.get(
'show_status_msgs_in_roster'):
status = contact.status.strip()
......
[info]
name: Chatstate in roster
short_name: chatstate
version: 0.4
version: 0.5
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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment