Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
204
Issues
204
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poezio
poezio
Commits
ae0888bd
Commit
ae0888bd
authored
Feb 08, 2021
by
mathieui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix
#3536
: Only use JID in affiliation
add nick if present.
parent
6c63cdb5
Pipeline
#3671
passed with stages
in 4 minutes and 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
13 deletions
+31
-13
poezio/tabs/muctab.py
poezio/tabs/muctab.py
+31
-13
No files found.
poezio/tabs/muctab.py
View file @
ae0888bd
...
...
@@ -240,7 +240,6 @@ class MucTab(ChatTab):
"""
Change the affiliation of a nick or JID
"""
if
not
self
.
joined
:
return
...
...
@@ -250,26 +249,45 @@ class MucTab(ChatTab):
'The affiliation must be one of '
+
', '
.
join
(
valid_affiliations
),
'Error'
)
return
if
nick_or_jid
in
[
user
.
nick
for
user
in
self
.
users
]:
nick
=
nick_or_jid
jid
=
None
else
:
nick
=
None
jid
=
None
nick
=
None
for
user
in
self
.
users
:
if
user
.
nick
==
nick_or_jid
:
jid
=
user
.
jid
nick
=
user
.
nick
break
if
jid
is
None
:
try
:
jid
=
JID
(
nick_or_jid
)
except
InvalidJID
:
self
.
core
.
information
(
'Invalid JID or missing occupant: %s'
%
nick_or_jid
,
'Error'
)
self
.
core
.
information
(
f
'Invalid JID or missing occupant:
{
nick_or_jid
}
'
,
'Error'
)
return
async
def
do_set_affiliation
(
room
:
JID
,
jid
:
Optional
[
JID
]
,
nick
:
Optional
[
str
],
affiliation
:
str
,
reason
:
str
):
async
def
do_set_affiliation
(
room
:
JID
,
jid
:
JID
,
nick
:
Optional
[
str
],
affiliation
:
str
,
reason
:
str
):
try
:
await
self
.
core
.
xmpp
[
'xep_0045'
].
set_affiliation
(
room
,
jid
,
nick
,
affiliation
=
affiliation
,
reason
=
reason
)
except
(
IqError
,
IqTimeout
)
as
e
:
await
self
.
core
.
xmpp
[
'xep_0045'
].
set_affiliation
(
room
,
nick
=
nick
,
jid
=
jid
,
affiliation
=
affiliation
,
reason
=
reason
)
self
.
core
.
information
(
f
"Affiliation of
{
jid
}
set to
{
affiliation
}
successfully"
,
"Info"
)
except
(
IqError
,
IqTimeout
)
as
exc
:
self
.
core
.
information
(
"Could not set affiliation '%s' for '%s': %s"
%
(
affiliation
,
nick_or_jid
,
e
),
"Warning"
)
f
"Could not set affiliation '
{
affiliation
}
' for '
{
jid
}
':
{
exc
}
"
,
"Warning"
,
)
asyncio
.
ensure_future
(
do_set_affiliation
(
self
.
jid
.
bare
,
jid
,
nick
,
affiliation
,
reason
))
asyncio
.
ensure_future
(
do_set_affiliation
(
self
.
jid
.
bare
,
jid
,
nick
,
affiliation
,
reason
)
)
def
change_role
(
self
,
nick
:
str
,
role
:
str
,
reason
:
str
=
''
)
->
None
:
"""
...
...
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