Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evert Mouw
gajim-plugins
Commits
ea470f89
Commit
ea470f89
authored
13 years ago
by
Dicson
Browse files
Options
Downloads
Patches
Plain Diff
chatstate.Show resource counter
parent
0f3e7d20
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
chatstate/chatstate.py
+29
-2
29 additions, 2 deletions
chatstate/chatstate.py
chatstate/manifest.ini
+1
-1
1 addition, 1 deletion
chatstate/manifest.ini
with
30 additions
and
3 deletions
chatstate/chatstate.py
+
29
−
2
View file @
ea470f89
...
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
chatstate/manifest.ini
+
1
−
1
View file @
ea470f89
[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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment