mirror of
https://github.com/gryf/weechat-xmpp.git
synced 2025-12-22 05:48:04 +01:00
add a prefix symbol in a MUC nicklist for moderators
This commit is contained in:
13
jabber.py
13
jabber.py
@@ -567,6 +567,7 @@ class Server:
|
|||||||
chan_user = muc.add_buddy(jid=node.getFrom())
|
chan_user = muc.add_buddy(jid=node.getFrom())
|
||||||
|
|
||||||
node_type = node.getType()
|
node_type = node.getType()
|
||||||
|
role = node.getRole()
|
||||||
if node_type in ["error", "unavailable"]:
|
if node_type in ["error", "unavailable"]:
|
||||||
nick = node.getNick()
|
nick = node.getNick()
|
||||||
code = node.getStatusCode()
|
code = node.getStatusCode()
|
||||||
@@ -578,7 +579,7 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
action='remove'
|
action='remove'
|
||||||
|
|
||||||
muc.update_nicklist(buddy=chan_user, action=action)
|
muc.update_nicklist(buddy=chan_user, action=action, role=role)
|
||||||
|
|
||||||
def presence_handler(self, conn, node):
|
def presence_handler(self, conn, node):
|
||||||
self.print_debug_handler("presence", node)
|
self.print_debug_handler("presence", node)
|
||||||
@@ -602,6 +603,7 @@ class Server:
|
|||||||
if name:
|
if name:
|
||||||
buddy.set_name(name.encode("utf-8"))
|
buddy.set_name(name.encode("utf-8"))
|
||||||
buddy.set_status(status=status, away=away)
|
buddy.set_status(status=status, away=away)
|
||||||
|
|
||||||
self.update_nicklist(buddy=buddy, action=action)
|
self.update_nicklist(buddy=buddy, action=action)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1250,7 +1252,7 @@ class MUC:
|
|||||||
buddy.resource)
|
buddy.resource)
|
||||||
weechat.prnt(self.chat.buffer, msg)
|
weechat.prnt(self.chat.buffer, msg)
|
||||||
|
|
||||||
def update_nicklist(self, buddy=None, action=None):
|
def update_nicklist(self, buddy=None, action=None, role=None):
|
||||||
"""Update buddy in nicklist
|
"""Update buddy in nicklist
|
||||||
Args:
|
Args:
|
||||||
buddy: Buddy object instance
|
buddy: Buddy object instance
|
||||||
@@ -1266,9 +1268,14 @@ class MUC:
|
|||||||
prefix = ''
|
prefix = ''
|
||||||
color = ''
|
color = ''
|
||||||
if action == 'update':
|
if action == 'update':
|
||||||
|
prefix = ""
|
||||||
|
role_color = ""
|
||||||
|
if role == "moderator":
|
||||||
|
prefix = "⚑ "
|
||||||
|
role_color = "red"
|
||||||
nick_color = "bar_fg"
|
nick_color = "bar_fg"
|
||||||
weechat.nicklist_add_nick(self.chat.buffer, "", buddy.resource,
|
weechat.nicklist_add_nick(self.chat.buffer, "", buddy.resource,
|
||||||
nick_color, "", "", 1)
|
nick_color, prefix, role_color, 1)
|
||||||
if not ptr_nick_gui:
|
if not ptr_nick_gui:
|
||||||
msg = 'joined'
|
msg = 'joined'
|
||||||
prefix = 'join'
|
prefix = 'join'
|
||||||
|
|||||||
Reference in New Issue
Block a user