Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
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
Weblate
gajim
Commits
21a39719
Commit
21a39719
authored
19 years ago
by
nkour
Browse files
Options
Downloads
Patches
Plain Diff
some more helpers for our API
parent
4c75c558
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/common/gajim.py
+31
-0
31 additions, 0 deletions
src/common/gajim.py
src/roster_window.py
+2
-27
2 additions, 27 deletions
src/roster_window.py
src/tabbed_chat_window.py
+2
-7
2 additions, 7 deletions
src/tabbed_chat_window.py
src/tooltips.py
+1
-1
1 addition, 1 deletion
src/tooltips.py
with
36 additions
and
35 deletions
src/common/gajim.py
+
31
−
0
View file @
21a39719
...
...
@@ -147,3 +147,34 @@ def get_resource_from_jid(jid):
def
get_number_of_accounts
():
return
len
(
connections
.
keys
())
def
get_transport_name_from_jid
(
self
,
jid
,
use_config_setting
=
True
):
'''
returns
'
aim
'
,
'
gg
'
,
'
irc
'
etc
'''
if
use_config_setting
or
not
gajim
.
config
.
get
(
'
use_transports_iconsets
'
):
return
host
=
jid
.
split
(
'
@
'
)[
-
1
]
if
host
.
startswith
(
'
aim
'
):
return
'
aim
'
elif
host
.
startswith
(
'
gadugadu
'
):
return
'
gadugadu
'
elif
host
.
startswith
(
'
gg
'
):
return
'
gadugadu
'
elif
host
.
startswith
(
'
irc
'
):
return
'
irc
'
# abc@icqsucks.org will match as ICQ, but what to do..
elif
host
.
startswith
(
'
icq
'
):
return
'
icq
'
elif
host
.
startswith
(
'
msn
'
):
return
'
msn
'
elif
host
.
startswith
(
'
sms
'
):
return
'
sms
'
elif
host
.
startswith
(
'
tlen
'
):
return
'
tlen
'
elif
host
.
startswith
(
'
yahoo
'
):
return
'
yahoo
'
def
jid_is_transport
(
jid
):
is_transport
=
jid
.
startswith
(
'
aim
'
)
or
jid
.
startswith
(
'
gadugadu
'
)
or
\
jid
.
startswith
(
'
irc
'
)
or
jid
.
startswith
(
'
icq
'
)
or
\
jid
.
startswith
(
'
msn
'
)
or
jid
.
startswith
(
'
sms
'
)
or
\
jid
.
startswith
(
'
yahoo
'
)
This diff is collapsed.
Click to expand it.
src/roster_window.py
+
2
−
27
View file @
21a39719
...
...
@@ -192,34 +192,9 @@ class RosterWindow:
if
group_empty
:
del
gajim
.
groups
[
account
][
group
]
def
get_transport_name_by_jid
(
self
,
jid
):
if
not
jid
or
not
gajim
.
config
.
get
(
'
use_transports_iconsets
'
):
return
None
host
=
jid
.
split
(
'
@
'
)[
-
1
]
if
host
.
startswith
(
'
aim
'
):
return
'
aim
'
elif
host
.
startswith
(
'
gadugadu
'
):
return
'
gadugadu
'
elif
host
.
startswith
(
'
gg
'
):
return
'
gadugadu
'
elif
host
.
startswith
(
'
irc
'
):
return
'
irc
'
# abc@icqsucks.org will match as ICQ, but what to do..
elif
host
.
startswith
(
'
icq
'
):
return
'
icq
'
elif
host
.
startswith
(
'
msn
'
):
return
'
msn
'
elif
host
.
startswith
(
'
sms
'
):
return
'
sms
'
elif
host
.
startswith
(
'
tlen
'
):
return
'
tlen
'
elif
host
.
startswith
(
'
yahoo
'
):
return
'
yahoo
'
return
None
def
get_appropriate_state_images
(
self
,
jid
):
'''
check jid and return the appropriate state images dict
'''
transport
=
self
.
get_transport_name_
by
_jid
(
jid
)
transport
=
gajim
.
get_transport_name_
from
_jid
(
jid
)
if
transport
:
return
self
.
transports_state_images
[
transport
]
return
self
.
jabber_state_images
...
...
@@ -248,7 +223,7 @@ class RosterWindow:
if
contact
.
ask
==
'
subscribe
'
:
img
=
state_images
[
'
requested
'
]
else
:
transport
=
self
.
get_transport_name_
by
_jid
(
jid
)
transport
=
gajim
.
get_transport_name_
from
_jid
(
jid
)
if
transport
and
state_images
.
has_key
(
contact
.
show
):
img
=
state_images
[
contact
.
show
]
else
:
...
...
This diff is collapsed.
Click to expand it.
src/tabbed_chat_window.py
+
2
−
7
View file @
21a39719
...
...
@@ -730,13 +730,8 @@ timestamp, contact):
def
restore_conversation
(
self
,
jid
):
# don't restore lines if it's a transport
is_transport
=
jid
.
startswith
(
'
aim
'
)
or
jid
.
startswith
(
'
gadugadu
'
)
or
\
jid
.
startswith
(
'
irc
'
)
or
jid
.
startswith
(
'
icq
'
)
or
\
jid
.
startswith
(
'
msn
'
)
or
jid
.
startswith
(
'
sms
'
)
or
\
jid
.
startswith
(
'
yahoo
'
)
if
is_transport
:
return
if
gajim
.
jid_is_transport
(
jid
):
return
# How many lines to restore and when to time them out
restore
=
gajim
.
config
.
get
(
'
restore_lines
'
)
...
...
This diff is collapsed.
Click to expand it.
src/tooltips.py
+
1
−
1
View file @
21a39719
...
...
@@ -304,7 +304,7 @@ class RosterTooltip(BaseTooltip, StatusTable):
# try to find the image for the contact status
state_file
=
prim_contact
.
show
.
replace
(
'
'
,
'
_
'
)
transport
=
self
.
plugin
.
roster
.
get_transport_name_
by
_jid
(
prim_contact
.
jid
)
transport
=
gajim
.
get_transport_name_
from
_jid
(
prim_contact
.
jid
)
if
transport
:
file_path
=
os
.
path
.
join
(
gajim
.
DATA_DIR
,
'
iconsets
'
,
'
transports
'
,
transport
,
'
16x16
'
)
...
...
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