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
4bebe8f7
Commit
4bebe8f7
authored
14 years ago
by
Dicson
Browse files
Options
Downloads
Patches
Plain Diff
clients_icons. don't use CAPS_RECEIVED event
parent
90ad0dea
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
clients_icons/clients_icons.py
+21
-34
21 additions, 34 deletions
clients_icons/clients_icons.py
clients_icons/manifest.ini
+1
-1
1 addition, 1 deletion
clients_icons/manifest.ini
with
22 additions
and
35 deletions
clients_icons/clients_icons.py
+
21
−
34
View file @
4bebe8f7
...
...
@@ -84,9 +84,7 @@ class ClientsIconsPlugin(GajimPlugin):
@log_calls
(
'
ClientsIconsPlugin
'
)
def
init
(
self
):
self
.
pos_list
=
[
'
after statusicon
'
,
'
befor avatar
'
]
self
.
events_handlers
=
{
'
CAPS_RECEIVED
'
:
(
ged
.
POSTGUI
,
self
.
caps_received
),
'
presence-received
'
:
self
.
events_handlers
=
{
'
presence-received
'
:
(
ged
.
POSTGUI
,
self
.
presence_received
),
'
gc-presence-received
'
:
(
ged
.
POSTGUI
,
self
.
gc_presence_received
),}
...
...
@@ -186,38 +184,24 @@ class ClientsIconsPlugin(GajimPlugin):
import
time
time
.
sleep
(
2
)
def
caps
_received
(
self
,
account
,
data
):
def
presence
_received
(
self
,
iq_obj
):
if
not
self
.
config
[
'
show_in_roster
'
]:
return
roster
=
gajim
.
interface
.
roster
jid
=
data
[
0
].
split
(
'
/
'
)[
0
]
for
account
in
gajim
.
contacts
.
get_accounts
():
contact
=
gajim
.
contacts
.
get_contact_with_highest_priority
(
account
,
jid
)
if
not
contact
:
continue
caps
=
contact
.
client_caps
.
_node
iter_
=
roster
.
_get_contact_iter
(
jid
,
account
,
contact
,
roster
.
model
)[
0
]
if
not
caps
:
if
roster
.
model
[
iter_
][
self
.
renderer_num
]
is
not
None
:
continue
if
self
.
config
[
'
show_unknown_icon
'
]:
roster
.
model
[
iter_
][
self
.
renderer_num
]
=
self
.
default_pixbuf
continue
client_icon
=
clients
.
get
(
caps
.
split
(
'
#
'
)[
0
],
None
)
if
not
client_icon
:
if
self
.
config
[
'
show_unknown_icon
'
]:
roster
.
model
[
iter_
][
self
.
renderer_num
]
=
self
.
default_pixbuf
continue
icon_path
=
os
.
path
.
join
(
self
.
local_file_path
(
'
icons
'
),
client_icon
)
pixbuf
=
gtk
.
gdk
.
pixbuf_new_from_file_at_size
(
icon_path
,
16
,
16
)
roster
.
model
[
iter_
][
self
.
renderer_num
]
=
pixbuf
def
presence_received
(
self
,
iq_obj
):
if
iq_obj
.
new_show
==
0
:
self
.
caps_received
(
iq_obj
.
conn
.
name
,
[
iq_obj
.
fjid
])
contact
=
gajim
.
contacts
.
get_contact_with_highest_priority
(
iq_obj
.
conn
.
name
,
iq_obj
.
jid
)
if
not
contact
:
return
iter_
=
roster
.
_get_contact_iter
(
iq_obj
.
jid
,
iq_obj
.
conn
.
name
,
contact
,
roster
.
model
)[
0
]
caps
=
contact
.
client_caps
.
_node
if
not
caps
:
tag
=
iq_obj
.
iq_obj
.
getTags
(
'
c
'
)
if
tag
:
caps
=
tag
[
0
].
getAttr
(
'
node
'
)
self
.
set_icon
(
roster
.
model
,
iter_
,
self
.
renderer_num
,
caps
)
return
self
.
set_icon
(
roster
.
model
,
iter_
,
self
.
renderer_num
,
caps
)
def
gc_presence_received
(
self
,
iq_obj
):
if
not
self
.
config
[
'
show_in_groupchats
'
]:
...
...
@@ -234,19 +218,22 @@ class ClientsIconsPlugin(GajimPlugin):
model
=
iq_obj
.
gc_control
.
list_treeview
.
get_model
()
if
model
[
iter_
][
self
.
muc_renderer_num
]
is
not
None
:
return
self
.
set_icon
(
model
,
iter_
,
self
.
muc_renderer_num
,
caps
)
def
set_icon
(
self
,
model
,
iter_
,
pos
,
caps
):
if
not
caps
:
if
self
.
config
[
'
show_unknown_icon
'
]:
model
[
iter_
][
self
.
muc_renderer_num
]
=
self
.
default_pixbuf
model
[
iter_
][
pos
]
=
self
.
default_pixbuf
return
client_icon
=
clients
.
get
(
caps
.
split
(
'
#
'
)[
0
],
None
)
if
not
client_icon
:
if
self
.
config
[
'
show_unknown_icon
'
]:
model
[
iter_
][
self
.
muc_renderer_num
]
=
self
.
default_pixbuf
model
[
iter_
][
pos
]
=
self
.
default_pixbuf
else
:
icon_path
=
os
.
path
.
join
(
self
.
local_file_path
(
'
icons
'
),
client_icon
)
pixbuf
=
gtk
.
gdk
.
pixbuf_new_from_file_at_size
(
icon_path
,
16
,
16
)
model
[
iter_
][
self
.
muc_renderer_num
]
=
pixbuf
model
[
iter_
][
pos
]
=
pixbuf
def
tree_cell_data_func
(
self
,
column
,
renderer
,
model
,
iter_
,
control
):
if
not
model
.
iter_parent
(
iter_
):
...
...
This diff is collapsed.
Click to expand it.
clients_icons/manifest.ini
+
1
−
1
View file @
4bebe8f7
[info]
name:
Clients
icons
short_name:
clients_icons
version:
0.
1
version:
0.
2
description:
Shows
the
client
icons
in
the
roster
and
in
groupchats.
authors
=
Denis Fomin <fominde@gmail.com>
...
...
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