X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fnumeric.c;h=997410683cc9e97a918b0e244c03a129b99c0906;hb=c7de505c919c5f550d848f9cafae99532bc1f789;hp=b0ceeef815e3d4cf91a8501801f36e983121e208;hpb=31b3c83c1f1b18fa1ed0501e95ed8e5f6cc6d407;p=ngircd-alex.git diff --git a/src/ngircd/numeric.c b/src/ngircd/numeric.c index b0ceeef8..99741068 100644 --- a/src/ngircd/numeric.c +++ b/src/ngircd/numeric.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors. + * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -176,6 +176,7 @@ Synchronize_Lists(CLIENT * Client) CHANNEL *c; struct list_head *head; struct list_elem *elem; + time_t t; assert(Client != NULL); @@ -183,9 +184,10 @@ Synchronize_Lists(CLIENT * Client) head = Class_GetList(CLASS_GLINE); elem = Lists_GetFirst(head); while (elem) { + t = Lists_GetValidity(elem) - time(NULL); if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s", Lists_GetMask(elem), - Lists_GetValidity(elem) - time(NULL), + t > 0 ? (long)t : 0, Lists_GetReason(elem))) return DISCONNECTED; elem = Lists_GetNext(elem); @@ -212,12 +214,11 @@ Synchronize_Lists(CLIENT * Client) static bool Send_CHANINFO(CLIENT * Client, CHANNEL * Chan) { - char *modes, *topic; + char *modes, *topic, *key; bool has_k, has_l; -#ifdef DEBUG - Log(LOG_DEBUG, "Sending CHANINFO commands ..."); -#endif + Log(LOG_DEBUG, "Sending CHANINFO commands for \"%s\" ...", + Channel_Name(Chan)); modes = Channel_Modes(Chan); topic = Channel_Topic(Chan); @@ -240,9 +241,10 @@ Send_CHANINFO(CLIENT * Client, CHANNEL * Chan) Channel_Name(Chan), modes, topic); } /* "CHANINFO + :" */ + key = Channel_Key(Chan); return IRC_WriteStrClient(Client, "CHANINFO %s +%s %s %lu :%s", Channel_Name(Chan), modes, - has_k ? Channel_Key(Chan) : "*", + has_k ? (key && *key ? key : "*") : "*", has_l ? Channel_MaxUsers(Chan) : 0, topic); } /* Send_CHANINFO */