mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Added nicklist_rename()
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1115 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
93ba91b8ed
commit
c49b5adc1b
@ -67,7 +67,7 @@ static void nicklist_destroy(CHANNEL_REC *channel, NICK_REC *nick)
|
||||
g_free(nick);
|
||||
}
|
||||
|
||||
/* remove nick from list */
|
||||
/* Remove nick from list */
|
||||
void nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick)
|
||||
{
|
||||
g_return_if_fail(IS_CHANNEL(channel));
|
||||
@ -77,6 +77,33 @@ void nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick)
|
||||
nicklist_destroy(channel, nick);
|
||||
}
|
||||
|
||||
/* Change nick */
|
||||
void nicklist_rename(SERVER_REC *server, const char *old_nick,
|
||||
const char *new_nick)
|
||||
{
|
||||
CHANNEL_REC *channel;
|
||||
NICK_REC *nickrec;
|
||||
GSList *nicks, *tmp;
|
||||
|
||||
nicks = nicklist_get_same(server, old_nick);
|
||||
for (tmp = nicks; tmp != NULL; tmp = tmp->next->next) {
|
||||
channel = tmp->data;
|
||||
nickrec = tmp->next->data;
|
||||
|
||||
/* remove old nick from hash table */
|
||||
g_hash_table_remove(channel->nicks, nickrec->nick);
|
||||
|
||||
g_free(nickrec->nick);
|
||||
nickrec->nick = g_strdup(new_nick);
|
||||
|
||||
/* add new nick to hash table */
|
||||
g_hash_table_insert(channel->nicks, nickrec->nick, nickrec);
|
||||
|
||||
signal_emit("nicklist changed", 3, channel, nickrec, old_nick);
|
||||
}
|
||||
g_slist_free(nicks);
|
||||
}
|
||||
|
||||
static NICK_REC *nicklist_find_wildcards(CHANNEL_REC *channel,
|
||||
const char *mask)
|
||||
{
|
||||
|
@ -15,8 +15,12 @@ struct _NICK_REC {
|
||||
/* Add new nick to list */
|
||||
NICK_REC *nicklist_insert(CHANNEL_REC *channel, const char *nick,
|
||||
int op, int voice, int send_massjoin);
|
||||
/* remove nick from list */
|
||||
/* Remove nick from list */
|
||||
void nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick);
|
||||
/* Change nick */
|
||||
void nicklist_rename(SERVER_REC *server, const char *old_nick,
|
||||
const char *new_nick);
|
||||
|
||||
/* Find nick record from list */
|
||||
NICK_REC *nicklist_find(CHANNEL_REC *channel, const char *mask);
|
||||
/* Get list of nicks that match the mask */
|
||||
|
Loading…
x
Reference in New Issue
Block a user