Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gajim
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
255
Issues
255
List
Board
Labels
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
gajim
Commits
e994b8f4
Commit
e994b8f4
authored
Jan 26, 2019
by
Philipp Hörist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Count MUC members correctly
- Pass Affiliation enum to get_uf_affiliation - Pass Role enum to get_uf_role
parent
80e5934b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
20 deletions
+20
-20
standard.py
gajim/command_system/implementation/standard.py
+2
-2
helpers.py
gajim/common/helpers.py
+8
-8
groupchat_control.py
gajim/groupchat_control.py
+7
-7
tooltips.py
gajim/gtk/tooltips.py
+1
-1
vcard.py
gajim/vcard.py
+2
-2
No files found.
gajim/command_system/implementation/standard.py
View file @
e994b8f4
...
...
@@ -379,8 +379,8 @@ class StandardGroupChatCommands(CommandContainer):
for
nick
in
nicks
:
contact
=
get_contact
(
nick
)
role
=
helpers
.
get_uf_role
(
contact
.
role
.
value
)
affiliation
=
helpers
.
get_uf_affiliation
(
contact
.
affiliation
.
value
)
role
=
helpers
.
get_uf_role
(
contact
.
role
)
affiliation
=
helpers
.
get_uf_affiliation
(
contact
.
affiliation
)
self
.
echo
(
"
%
s -
%
s -
%
s"
%
(
nick
,
role
,
affiliation
))
@
command
(
'ignore'
,
raw
=
True
)
...
...
gajim/common/helpers.py
View file @
e994b8f4
...
...
@@ -327,19 +327,19 @@ def get_uf_ask(ask):
def
get_uf_role
(
role
,
plural
=
False
):
''' plural determines if you get Moderators or Moderator'''
if
role
==
'none'
:
if
role
.
value
==
'none'
:
role_name
=
Q_
(
'?Group Chat Contact Role:None'
)
elif
role
==
'moderator'
:
elif
role
.
value
==
'moderator'
:
if
plural
:
role_name
=
_
(
'Moderators'
)
else
:
role_name
=
_
(
'Moderator'
)
elif
role
==
'participant'
:
elif
role
.
value
==
'participant'
:
if
plural
:
role_name
=
_
(
'Participants'
)
else
:
role_name
=
_
(
'Participant'
)
elif
role
==
'visitor'
:
elif
role
.
value
==
'visitor'
:
if
plural
:
role_name
=
_
(
'Visitors'
)
else
:
...
...
@@ -348,13 +348,13 @@ def get_uf_role(role, plural=False):
def
get_uf_affiliation
(
affiliation
):
'''Get a nice and translated affilition for muc'''
if
affiliation
==
'none'
:
if
affiliation
.
value
==
'none'
:
affiliation_name
=
Q_
(
'?Group Chat Contact Affiliation:None'
)
elif
affiliation
==
'owner'
:
elif
affiliation
.
value
==
'owner'
:
affiliation_name
=
_
(
'Owner'
)
elif
affiliation
==
'admin'
:
elif
affiliation
.
value
==
'admin'
:
affiliation_name
=
_
(
'Administrator'
)
elif
affiliation
==
'member'
:
elif
affiliation
.
value
==
'member'
:
affiliation_name
=
_
(
'Member'
)
else
:
# Argl ! An unknown affiliation !
affiliation_name
=
affiliation
.
capitalize
()
...
...
gajim/groupchat_control.py
View file @
e994b8f4
...
...
@@ -1768,7 +1768,7 @@ class GroupchatControl(ChatControlBase):
self
.
model
[
role_iter
][
Column
.
TEXT
]
=
role_name
def
draw_all_roles
(
self
):
for
role
in
(
'visitor'
,
'participant'
,
'moderator'
):
for
role
in
(
Role
.
VISITOR
,
Role
.
PARTICIPANT
,
Role
.
MODERATOR
):
self
.
draw_role
(
role
)
def
_change_nick
(
self
,
new_nick
:
str
)
->
None
:
...
...
@@ -1899,7 +1899,7 @@ class GroupchatControl(ChatControlBase):
return
affiliation
=
helpers
.
get_uf_affiliation
(
event
.
properties
.
affiliation
.
value
)
event
.
properties
.
affiliation
)
nick
=
event
.
properties
.
muc_nickname
reason
=
event
.
properties
.
muc_user
.
reason
reason
=
''
if
reason
is
None
else
': {reason}'
.
format
(
reason
=
reason
)
...
...
@@ -1932,7 +1932,7 @@ class GroupchatControl(ChatControlBase):
if
event
.
room_jid
!=
self
.
room_jid
:
return
role
=
helpers
.
get_uf_role
(
event
.
properties
.
role
.
value
)
role
=
helpers
.
get_uf_role
(
event
.
properties
.
role
)
nick
=
event
.
properties
.
muc_nickname
reason
=
event
.
properties
.
muc_user
.
reason
reason
=
''
if
reason
is
None
else
': {reason}'
.
format
(
reason
=
reason
)
...
...
@@ -2167,17 +2167,17 @@ class GroupchatControl(ChatControlBase):
contact
=
app
.
contacts
.
get_gc_contact
(
self
.
account
,
self
.
room_jid
,
nick
)
role_name
=
helpers
.
get_uf_role
(
contact
.
role
.
value
,
plural
=
True
)
role_name
=
helpers
.
get_uf_role
(
contact
.
role
,
plural
=
True
)
# Create Role
role_iter
=
self
.
get_role_iter
(
contact
.
role
.
value
)
role_iter
=
self
.
get_role_iter
(
contact
.
role
)
if
not
role_iter
:
icon_name
=
get_icon_name
(
'closed'
)
ext_columns
=
[
None
]
*
self
.
nb_ext_renderers
row
=
[
icon_name
,
contact
.
role
.
value
,
'role'
,
role_name
,
None
]
+
ext_columns
role_iter
=
self
.
model
.
append
(
None
,
row
)
self
.
_role_refs
[
contact
.
role
.
value
]
=
Gtk
.
TreeRowReference
(
self
.
_role_refs
[
contact
.
role
]
=
Gtk
.
TreeRowReference
(
self
.
model
,
self
.
model
.
get_path
(
role_iter
))
# Avatar
...
...
@@ -2262,7 +2262,7 @@ class GroupchatControl(ChatControlBase):
del
self
.
_contact_refs
[
nick
]
if
self
.
model
.
iter_n_children
(
parent_iter
)
==
0
:
role
=
self
.
model
[
parent_iter
][
Column
.
NICK
]
del
self
.
_role_refs
[
role
]
del
self
.
_role_refs
[
Role
(
role
)
]
self
.
model
.
remove
(
parent_iter
)
def
_message_sent
(
self
,
obj
):
...
...
gajim/gtk/tooltips.py
View file @
e994b8f4
...
...
@@ -214,7 +214,7 @@ class GCTooltip():
# Affiliation
if
not
contact
.
affiliation
.
is_none
:
uf_affiliation
=
helpers
.
get_uf_affiliation
(
contact
.
affiliation
.
value
)
uf_affiliation
=
helpers
.
get_uf_affiliation
(
contact
.
affiliation
)
uf_affiliation
=
\
_
(
'
%(owner_or_admin_or_member)
s of this group chat'
)
\
%
{
'owner_or_admin_or_member'
:
uf_affiliation
}
...
...
gajim/vcard.py
View file @
e994b8f4
...
...
@@ -372,11 +372,11 @@ class VcardWindow:
ask_label
=
self
.
xml
.
get_object
(
'ask_label'
)
if
self
.
gc_contact
:
self
.
xml
.
get_object
(
'subscription_title_label'
)
.
set_markup
(
Q_
(
"?Role in Group Chat:<b>Role:</b>"
))
uf_role
=
helpers
.
get_uf_role
(
self
.
gc_contact
.
role
.
value
)
uf_role
=
helpers
.
get_uf_role
(
self
.
gc_contact
.
role
)
subscription_label
.
set_text
(
uf_role
)
self
.
xml
.
get_object
(
'ask_title_label'
)
.
set_markup
(
_
(
"<b>Affiliation:</b>"
))
uf_affiliation
=
helpers
.
get_uf_affiliation
(
self
.
gc_contact
.
affiliation
.
value
)
uf_affiliation
=
helpers
.
get_uf_affiliation
(
self
.
gc_contact
.
affiliation
)
ask_label
.
set_text
(
uf_affiliation
)
else
:
uf_sub
=
helpers
.
get_uf_sub
(
self
.
contact
.
sub
)
...
...
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