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
c09b4aaa
Commit
c09b4aaa
authored
17 years ago
by
roidelapluie
Browse files
Options
Downloads
Patches
Plain Diff
Add send_groupchat_message to gajim-remote. Fix #2447.
parent
612e468c
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
src/gajim-remote.py
+9
-0
9 additions, 0 deletions
src/gajim-remote.py
src/remote_control.py
+38
-0
38 additions, 0 deletions
src/remote_control.py
with
47 additions
and
0 deletions
src/gajim-remote.py
+
9
−
0
View file @
c09b4aaa
...
...
@@ -137,6 +137,15 @@ class GajimRemote:
'
using this account
'
),
False
),
]
],
'
send_groupchat_message
'
:[
_
(
'
Sends new message to a groupchat you
\'
ve joined.
'
),
[
(
'
room_jid
'
,
_
(
'
JID of the room that will receive the message
'
),
True
),
(
_
(
'
message
'
),
_
(
'
message contents
'
),
True
),
(
_
(
'
account
'
),
_
(
'
if specified, the message will be sent
'
'
using this account
'
),
False
),
]
],
'
contact_info
'
:
[
_
(
'
Gets detailed info on a contact
'
),
[
...
...
This diff is collapsed.
Click to expand it.
src/remote_control.py
+
38
−
0
View file @
c09b4aaa
...
...
@@ -225,6 +225,31 @@ class SignalObject(dbus.service.Object):
return
connected_account
,
contact
def
_get_account_for_groupchat
(
self
,
account
,
room_jid
):
'''
get the account which is connected to groupchat (if not given)
or check if the given account is connected to the groupchat
'''
correct_account
=
None
accounts
=
gajim
.
contacts
.
get_accounts
()
# if there is only one account in roster, take it as default
# if user did not ask for account
if
not
account
and
len
(
accounts
)
==
1
:
account
=
accounts
[
0
]
if
account
:
if
gajim
.
connections
[
account
].
connected
>
1
and
\
room_jid
in
gajim
.
gc_connected
[
account
]
and
\
gajim
.
gc_connected
[
account
][
room_jid
]:
# account and groupchat are connected
connected_account
=
account
else
:
for
account
in
accounts
:
if
gajim
.
connections
[
account
].
connected
>
1
and
\
room_jid
in
gajim
.
gc_connected
[
account
]
and
\
gajim
.
gc_connected
[
account
][
room_jid
]:
# account and groupchat are connected
connected_account
=
account
break
return
connected_account
@dbus.service.method
(
INTERFACE
,
in_signature
=
'
sss
'
,
out_signature
=
'
b
'
)
def
send_file
(
self
,
file_path
,
jid
,
account
):
'''
send file, located at
'
file_path
'
to
'
jid
'
, using account
...
...
@@ -271,6 +296,19 @@ class SignalObject(dbus.service.Object):
jid
=
self
.
_get_real_jid
(
jid
,
account
)
return
self
.
_send_message
(
jid
,
message
,
keyID
,
account
,
type
,
subject
)
@dbus.service.method
(
INTERFACE
,
in_signature
=
'
sss
'
,
out_signature
=
'
b
'
)
def
send_groupchat_message
(
self
,
room_jid
,
message
,
account
):
'''
Send
'
message
'
to groupchat
'
room_jid
'
,
using account (optional)
'
account
'
.
'''
if
not
room_jid
or
not
message
:
return
DBUS_BOOLEAN
(
False
)
connected_account
=
self
.
_get_account_for_groupchat
(
account
,
room_jid
)
if
connected_account
:
connection
=
gajim
.
connections
[
connected_account
]
connection
.
send_gc_message
(
room_jid
,
message
)
return
DBUS_BOOLEAN
(
True
)
return
DBUS_BOOLEAN
(
False
)
@dbus.service.method
(
INTERFACE
,
in_signature
=
'
ss
'
,
out_signature
=
'
b
'
)
def
open_chat
(
self
,
jid
,
account
):
'''
Shows the tabbed window for new message to
'
jid
'
, using account
...
...
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