summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-channel.c10
-rw-r--r--src/plugins/jabber/jabber-muc.c10
2 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index 66b116c02..7f06e0939 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -308,18 +308,28 @@ irc_channel_nick_speaking_add (struct t_irc_channel *channel,
const char *nick_name, int highlight)
{
int size, to_remove, i;
+ struct t_weelist_item *ptr_item;
if (highlight < 0)
highlight = 0;
if (highlight > 1)
highlight = 1;
+ /* create list if it does not exist */
if (!channel->nicks_speaking[highlight])
channel->nicks_speaking[highlight] = weechat_list_new ();
+ /* remove item if it was already in list */
+ ptr_item = weechat_list_casesearch (channel->nicks_speaking[highlight],
+ nick_name);
+ if (ptr_item)
+ weechat_list_remove (channel->nicks_speaking[highlight], ptr_item);
+
+ /* add nick in list */
weechat_list_add (channel->nicks_speaking[highlight], nick_name,
WEECHAT_LIST_POS_END);
+ /* reduce list size if it's too big */
size = weechat_list_size (channel->nicks_speaking[highlight]);
if (size > IRC_CHANNEL_NICKS_SPEAKING_LIMIT)
{
diff --git a/src/plugins/jabber/jabber-muc.c b/src/plugins/jabber/jabber-muc.c
index 109ffd273..dd24d2e26 100644
--- a/src/plugins/jabber/jabber-muc.c
+++ b/src/plugins/jabber/jabber-muc.c
@@ -253,18 +253,28 @@ jabber_muc_buddy_speaking_add (struct t_jabber_muc *muc, const char *buddy_name,
int highlight)
{
int size, to_remove, i;
+ struct t_weelist_item *ptr_item;
if (highlight < 0)
highlight = 0;
if (highlight > 1)
highlight = 1;
+ /* create list if it does not exist */
if (!muc->buddies_speaking[highlight])
muc->buddies_speaking[highlight] = weechat_list_new ();
+ /* remove item if it was already in list */
+ ptr_item = weechat_list_casesearch (muc->buddies_speaking[highlight],
+ buddy_name);
+ if (ptr_item)
+ weechat_list_remove (muc->buddies_speaking[highlight], ptr_item);
+
+ /* add buddy in list */
weechat_list_add (muc->buddies_speaking[highlight], buddy_name,
WEECHAT_LIST_POS_END);
+ /* reduce list size if it's too big */
size = weechat_list_size (muc->buddies_speaking[highlight]);
if (size > JABBER_MUC_BUDDIES_SPEAKING_LIMIT)
{