Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
poezio
poezio
Commits
cf50ef2c
Commit
cf50ef2c
authored
Jul 01, 2018
by
Maxime Buquet
Browse files
Use identites from server for muc service
Signed-off-by:
Maxime “pep” Buquet
<
pep@bouah.net
>
parent
dc2808cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
18 deletions
+37
-18
poezio/core/core.py
poezio/core/core.py
+32
-18
poezio/core/handlers.py
poezio/core/handlers.py
+5
-0
No files found.
poezio/core/core.py
View file @
cf50ef2c
...
...
@@ -877,27 +877,41 @@ class Core:
contacts to join in.
"""
# Use config.default_muc_service as muc component if available,
# otherwise find muc component by disco#items-ing the user domain. If
# not, give up
default_muc
=
config
.
get
(
'default_muc_service'
)
if
not
default_muc
:
self
.
information
(
"Error finding a MUC service to join. If your server does not "
"provide one, set 'default_muc_service' manually to a MUC "
"service that allows room creation."
,
'Error'
)
return
def
callback
(
results
):
muc_from_identity
=
''
for
info
in
results
:
for
identity
in
info
[
'disco_info'
][
'identities'
]:
if
identity
[
0
]
==
'conference'
and
identity
[
1
]
==
'text'
:
muc_from_identity
=
info
[
'from'
].
bare
# Use config.default_muc_service as muc component if available,
# otherwise find muc component by disco#items-ing the user domain.
# If not, give up
default_muc
=
config
.
get
(
'default_muc_service'
,
muc_from_identity
)
if
not
default_muc
:
self
.
information
(
"Error finding a MUC service to join. If your server does not "
"provide one, set 'default_muc_service' manually to a MUC "
"service that allows room creation."
,
'Error'
)
return
nick
=
self
.
own_nick
room
=
uuid
.
uuid4
().
hex
+
'@'
+
default_muc
nick
=
self
.
o
w
n_n
ick
room
=
uuid
.
uuid4
().
hex
+
'@'
+
default_muc
self
.
o
pe
n_n
ew_room
(
room
,
nick
).
join
()
self
.
information
(
'Room %s created'
%
room
,
'Info'
)
self
.
open_new_room
(
room
,
nick
).
join
()
self
.
in
formation
(
'Room %s created'
%
room
,
'Info'
)
for
jid
in
jids
:
self
.
in
vite
(
jid
,
room
)
for
jid
in
jids
:
self
.
invite
(
jid
,
room
)
asyncio
.
ensure_future
(
self
.
xmpp
[
'xep_0030'
].
get_info_from_domain
(
callback
=
callback
,
)
)
def
get_error_message
(
self
,
stanza
,
deprecated
:
bool
=
False
):
"""
...
...
poezio/core/handlers.py
View file @
cf50ef2c
...
...
@@ -97,6 +97,11 @@ class HandlerCore:
self
.
core
.
xmpp
.
plugin
[
'xep_0030'
].
get_info
(
jid
=
self
.
core
.
xmpp
.
boundjid
.
domain
,
callback
=
callback
)
def
find_identities
(
self
,
_
):
asyncio
.
ensure_future
(
self
.
core
.
xmpp
[
'xep_0030'
].
get_info_from_domain
(),
)
def
on_carbon_received
(
self
,
message
):
"""
Carbon <received/> received
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment