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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Peter Shkenev
gajim
Commits
be43c2c8
Commit
be43c2c8
authored
19 years ago
by
dkirov
Browse files
Options
Downloads
Patches
Plain Diff
added add_contact and remove_contact methods
parent
08a1bae7
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
src/gajim-remote.py
+16
-0
16 additions, 0 deletions
src/gajim-remote.py
src/remote_control.py
+31
-1
31 additions, 1 deletion
src/remote_control.py
with
47 additions
and
1 deletion
src/gajim-remote.py
+
16
−
0
View file @
be43c2c8
...
...
@@ -173,7 +173,23 @@ def __init__(self):
_
(
'
Write the current state of Gajim preferences to the
\
.config file
'
),
[
]
],
'
remove_contact
'
:
[
_
(
'
Remove contact from roster
'
),
[
(
'
jid
'
,
_
(
'
JID of the contact
'
),
True
),
(
_
(
'
account
'
),
_
(
'
if specified, contact is taken from
\
the contact list of this account
'
),
False
)
]
],
'
add_contact
'
:
[
_
(
'
Add contact to roster
'
),
[
(
_
(
'
account
'
),
_
(
'
Add new contact to this account.
'
),
True
)
]
]
}
if
self
.
argv_len
<
2
or
\
sys
.
argv
[
1
]
not
in
self
.
commands
.
keys
():
# no args or bad args
...
...
This diff is collapsed.
Click to expand it.
src/remote_control.py
+
31
−
1
View file @
be43c2c8
...
...
@@ -25,7 +25,7 @@
from
common
import
gajim
from
time
import
time
from
common
import
i18n
from
dialogs
import
AddNewContactWindow
_
=
i18n
.
_
try
:
...
...
@@ -107,6 +107,8 @@ def __init__(self, service, plugin):
self
.
prefs_store
,
self
.
prefs_del
,
self
.
prefs_put
,
self
.
add_contact
,
self
.
remove_contact
])
def
raise_signal
(
self
,
signal
,
arg
):
...
...
@@ -410,6 +412,32 @@ def prefs_put(self, *args):
gajim
.
config
.
set_per
(
key_path
[
0
],
key_path
[
1
],
subname
,
value
)
return
True
def
add_contact
(
self
,
*
args
):
[
account
]
=
self
.
_get_real_arguments
(
args
,
1
)
if
gajim
.
contacts
.
has_key
(
account
):
AddNewContactWindow
(
self
.
plugin
,
account
)
return
True
return
False
def
remove_contact
(
self
,
*
args
):
[
jid
,
account
]
=
self
.
_get_real_arguments
(
args
,
2
)
accounts
=
gajim
.
contacts
.
keys
()
# if there is only one account in roster, take it as default
if
account
:
accounts
=
[
account
]
else
:
accounts
=
gajim
.
contacts
.
keys
()
contact_exists
=
False
for
account
in
accounts
:
if
gajim
.
contacts
[
account
].
has_key
(
jid
):
gajim
.
connections
[
account
].
unsubscribe
(
jid
)
for
contact
in
gajim
.
contacts
[
account
][
jid
]:
self
.
plugin
.
roster
.
remove_contact
(
contact
,
account
)
del
gajim
.
contacts
[
account
][
jid
]
contact_exists
=
True
return
contact_exists
def
_is_first
(
self
):
if
self
.
first_show
:
self
.
first_show
=
False
...
...
@@ -479,6 +507,8 @@ def _serialized_contacts(self, contacts):
prefs_put
=
method
(
INTERFACE
)(
prefs_put
)
prefs_del
=
method
(
INTERFACE
)(
prefs_del
)
prefs_store
=
method
(
INTERFACE
)(
prefs_store
)
remove_contact
=
method
(
INTERFACE
)(
remove_contact
)
add_contact
=
method
(
INTERFACE
)(
add_contact
)
class
SessionBusNotPresent
(
Exception
):
'''
This exception indicates that there is no session daemon
'''
...
...
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