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
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
gajim
gajim-plugins
Commits
43ef2e04
Commit
43ef2e04
authored
12 years ago
by
Dicson
Browse files
Options
Downloads
Patches
Plain Diff
ClientsIconsPlugin. Refactoring
parent
ca9405c8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clients_icons/clients_icons.py
+25
-19
25 additions, 19 deletions
clients_icons/clients_icons.py
with
25 additions
and
19 deletions
clients_icons/clients_icons.py
+
25
−
19
View file @
43ef2e04
...
@@ -312,6 +312,10 @@ class ClientsIconsPlugin(GajimPlugin):
...
@@ -312,6 +312,10 @@ class ClientsIconsPlugin(GajimPlugin):
if
client
in
contact
.
resource
.
lower
():
if
client
in
contact
.
resource
.
lower
():
caps
=
libpurple_clients
[
client
]
caps
=
libpurple_clients
[
client
]
caps_from_jid
=
self
.
check_jid
(
contact
.
jid
)
if
caps_from_jid
:
caps
=
caps_from_jid
caps_
=
caps
.
split
(
'
#
'
)[
0
].
split
()
caps_
=
caps
.
split
(
'
#
'
)[
0
].
split
()
if
caps_
:
if
caps_
:
client_icon
=
clients
.
get
(
caps_
[
0
].
split
()[
0
],
(
None
,))[
0
]
client_icon
=
clients
.
get
(
caps_
[
0
].
split
()[
0
],
(
None
,))[
0
]
...
@@ -337,6 +341,20 @@ class ClientsIconsPlugin(GajimPlugin):
...
@@ -337,6 +341,20 @@ class ClientsIconsPlugin(GajimPlugin):
vcard_table
):
vcard_table
):
pass
pass
def
check_jid
(
self
,
jid
):
caps
=
None
if
'
facebook.com
'
in
jid
and
self
.
config
[
'
show_facebook
'
]:
caps
=
'
facebook.com
'
elif
'
@vk.com
'
in
jid
and
self
.
config
[
'
show_facebook
'
]:
caps
=
'
vk.com
'
elif
jid
==
'
juick@juick.com
'
:
caps
=
'
http://juick.com/caps
'
elif
jid
==
'
psto@psto.net
'
:
caps
=
'
psto@psto.net
'
elif
jid
==
'
rss@isida-bot.com
'
:
caps
=
'
rss@isida-bot.com
'
return
caps
@log_calls
(
'
ClientsIconsPlugin
'
)
@log_calls
(
'
ClientsIconsPlugin
'
)
def
connect_with_roster_draw_contact
(
self
,
roster
,
jid
,
account
,
contact
):
def
connect_with_roster_draw_contact
(
self
,
roster
,
jid
,
account
,
contact
):
if
not
self
.
active
:
if
not
self
.
active
:
...
@@ -349,16 +367,8 @@ class ClientsIconsPlugin(GajimPlugin):
...
@@ -349,16 +367,8 @@ class ClientsIconsPlugin(GajimPlugin):
return
return
if
roster
.
model
[
child_iters
[
0
]][
self
.
renderer_num
]
is
None
:
if
roster
.
model
[
child_iters
[
0
]][
self
.
renderer_num
]
is
None
:
caps
=
contact
.
client_caps
.
_node
caps
=
contact
.
client_caps
.
_node
if
'
facebook.com
'
in
jid
and
self
.
config
[
'
show_facebook
'
]:
if
not
caps
:
caps
=
'
facebook.com
'
caps
=
self
.
check_jid
(
jid
)
elif
'
@vk.com
'
in
jid
and
self
.
config
[
'
show_facebook
'
]:
caps
=
'
vk.com
'
elif
jid
==
'
juick@juick.com
'
:
caps
=
'
http://juick.com/caps
'
elif
jid
==
'
psto@psto.net
'
:
caps
=
'
psto@psto.net
'
elif
jid
==
'
rss@isida-bot.com
'
:
caps
=
'
rss@isida-bot.com
'
self
.
set_icon
(
roster
.
model
,
child_iters
[
0
],
self
.
renderer_num
,
self
.
set_icon
(
roster
.
model
,
child_iters
[
0
],
self
.
renderer_num
,
caps
)
caps
)
...
@@ -518,15 +528,11 @@ class ClientsIconsPlugin(GajimPlugin):
...
@@ -518,15 +528,11 @@ class ClientsIconsPlugin(GajimPlugin):
for
client
in
libpurple_clients
:
for
client
in
libpurple_clients
:
if
client
in
contact
.
resource
.
lower
():
if
client
in
contact
.
resource
.
lower
():
caps
=
libpurple_clients
[
client
]
caps
=
libpurple_clients
[
client
]
if
'
facebook.com
'
in
iq_obj
.
jid
and
self
.
config
[
'
show_facebook
'
]:
caps
=
'
facebook.com
'
caps_from_jid
=
self
.
check_jid
(
iq_obj
.
jid
)
if
not
caps
:
if
caps_from_jid
:
if
iq_obj
.
jid
==
'
juick@juick.com
'
:
caps
=
caps_from_jid
caps
=
'
http://juick.com/caps
'
elif
'
@vk.com
'
in
iq_obj
.
jid
and
self
.
config
[
'
show_facebook
'
]:
caps
=
'
vk.com
'
elif
'
psto@psto.net
'
in
iq_obj
.
jid
:
caps
=
'
psto@psto.net
'
self
.
set_icon
(
roster
.
model
,
iter_
,
self
.
renderer_num
,
caps
)
self
.
set_icon
(
roster
.
model
,
iter_
,
self
.
renderer_num
,
caps
)
def
gc_presence_received
(
self
,
iq_obj
):
def
gc_presence_received
(
self
,
iq_obj
):
...
...
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