1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

nickliset_set_host() for setting host, sends signal "nicklist host changed".

Changed "nick gone|serverop" -> "nicklist gone|serverop changed"


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1137 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-01-21 00:49:52 +00:00 committed by cras
parent 1157ed5800
commit 443ba1a97d
4 changed files with 23 additions and 5 deletions

View File

@ -57,6 +57,19 @@ NICK_REC *nicklist_insert(CHANNEL_REC *channel, const char *nick,
return rec; return rec;
} }
/* Set host address for nick */
void nicklist_set_host(CHANNEL_REC *channel, NICK_REC *nick, const char *host)
{
g_return_if_fail(channel != NULL);
g_return_if_fail(nick != NULL);
g_return_if_fail(host != NULL);
g_free_not_null(nick->host);
nick->host = g_strdup(host);
signal_emit("nicklist host changed", 2, channel, nick);
}
static void nicklist_destroy(CHANNEL_REC *channel, NICK_REC *nick) static void nicklist_destroy(CHANNEL_REC *channel, NICK_REC *nick)
{ {
signal_emit("nicklist remove", 2, channel, nick); signal_emit("nicklist remove", 2, channel, nick);
@ -257,12 +270,12 @@ void nicklist_update_flags(SERVER_REC *server, const char *nick,
if (gone != -1 && (int)rec->gone != gone) { if (gone != -1 && (int)rec->gone != gone) {
rec->gone = gone; rec->gone = gone;
signal_emit("nick gone changed", 2, channel, rec); signal_emit("nicklist gone changed", 2, channel, rec);
} }
if (serverop != -1 && (int)rec->serverop != serverop) { if (serverop != -1 && (int)rec->serverop != serverop) {
rec->serverop = serverop; rec->serverop = serverop;
signal_emit("nick serverop changed", 2, channel, rec); signal_emit("nicklist serverop changed", 2, channel, rec);
} }
} }
g_slist_free(nicks); g_slist_free(nicks);

View File

@ -15,6 +15,8 @@ struct _NICK_REC {
/* Add new nick to list */ /* Add new nick to list */
NICK_REC *nicklist_insert(CHANNEL_REC *channel, const char *nick, NICK_REC *nicklist_insert(CHANNEL_REC *channel, const char *nick,
int op, int voice, int send_massjoin); int op, int voice, int send_massjoin);
/* Set host address for nick */
void nicklist_set_host(CHANNEL_REC *channel, NICK_REC *nick, const char *host);
/* Remove nick from list */ /* Remove nick from list */
void nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick); void nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick);
/* Change nick */ /* Change nick */

View File

@ -134,8 +134,11 @@ static void event_who(SERVER_REC *server, const char *data)
nickrec = chanrec == NULL ? NULL : nickrec = chanrec == NULL ? NULL :
nicklist_find(chanrec, nick); nicklist_find(chanrec, nick);
if (nickrec != NULL) { if (nickrec != NULL) {
if (nickrec->host == NULL) if (nickrec->host == NULL) {
nickrec->host = g_strdup_printf("%s@%s", user, host); char *str = g_strdup_printf("%s@%s", user, host);
nicklist_set_host(chanrec, nickrec, str);
g_free(str);
}
if (nickrec->realname == NULL) if (nickrec->realname == NULL)
nickrec->realname = g_strdup(realname); nickrec->realname = g_strdup(realname);
sscanf(hops, "%d", &nickrec->hops); sscanf(hops, "%d", &nickrec->hops);

View File

@ -59,7 +59,7 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
/* add user to nicklist */ /* add user to nicklist */
nickrec = nicklist_insert(CHANNEL(chanrec), nick, FALSE, FALSE, TRUE); nickrec = nicklist_insert(CHANNEL(chanrec), nick, FALSE, FALSE, TRUE);
nickrec->host = g_strdup(address); nicklist_set_host(CHANNEL(chanrec), nickrec, address);
if (chanrec->massjoins == 0) { if (chanrec->massjoins == 0) {
/* no nicks waiting in massjoin queue */ /* no nicks waiting in massjoin queue */