diff options
author | Berke Viktor <bviktor@hexchat.org> | 2013-05-15 11:43:38 +0200 |
---|---|---|
committer | Berke Viktor <bviktor@hexchat.org> | 2013-05-15 11:43:38 +0200 |
commit | 8cf025f18d85c079a8e95140cdc5abc8b6fc9c04 (patch) | |
tree | 68cd74f675a885f4ec8448a7e0389b86a99dddee /src/common/servlist.c | |
parent | 81990ce53b90aa3351ef5981ce2a74c54a1f85f5 (diff) |
Fix autojoins for sessions
Diffstat (limited to 'src/common/servlist.c')
-rw-r--r-- | src/common/servlist.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/common/servlist.c b/src/common/servlist.c index b55498cc..da0b746d 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -998,30 +998,44 @@ servlist_command_add (ircnet *net, char *cmd) return entry; } -favchannel * -servlist_favchan_add (ircnet *net, char *channel) +GSList * +servlist_favchan_listadd (GSList *chanlist, char *channel, char *key) { - int pos; favchannel *chan; chan = malloc (sizeof (favchannel)); memset (chan, 0, sizeof (favchannel)); + chan->name = g_strdup (channel); + chan->key = g_strdup (key); + chanlist = g_slist_append (chanlist, chan); + + return chanlist; +} + +void +servlist_favchan_add (ircnet *net, char *channel) +{ + int pos; + char *name; + char *key; + if (strchr (channel, ',') != NULL) { pos = (int) (strchr (channel, ',') - channel); - chan->name = g_strndup (channel, pos); - chan->key = g_strdup (channel + pos + 1); + name = g_strndup (channel, pos); + key = g_strdup (channel + pos + 1); } else { - chan->name = g_strdup (channel); - chan->key = NULL; + name = g_strdup (channel); + key = NULL; } - net->favchanlist = g_slist_append (net->favchanlist, chan); + net->favchanlist = servlist_favchan_listadd (net->favchanlist, name, key); - return chan; + g_free (name); + g_free (key); } void |