From: pk910 Date: Sat, 10 Nov 2012 17:12:01 +0000 (+0100) Subject: search another bot if unable to send funcmd replies over textbot X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=1ed920f7647e213e018b559e65174ab2f9fbbf70 search another bot if unable to send funcmd replies over textbot --- diff --git a/src/modules/funcmd.mod/cmd_funcmds.c b/src/modules/funcmd.mod/cmd_funcmds.c index 46a068e..eda55cc 100644 --- a/src/modules/funcmd.mod/cmd_funcmds.c +++ b/src/modules/funcmd.mod/cmd_funcmds.c @@ -127,6 +127,7 @@ free(header); #define REPLYTYPE_NOTICE 0x04 static void funcmd_reply(struct funcmd_header_info *header, const char *text, int type, ...) { if (!(header->client->flags & SOCKET_FLAG_CONNECTED)) return; + struct ClientSocket *client = header->client; const char *reply_format = get_language_string((header->null_language ? NULL : header->user), text); if(reply_format) text = reply_format; @@ -141,6 +142,8 @@ static void funcmd_reply(struct funcmd_header_info *header, const char *text, in sprintf(formatBuf, "PRIVMSG %s :\001ACTION %s\001", header->chan->name, text); else sprintf(formatBuf, "PRIVMSG %s :%s", header->chan->name, text); + if(!isUserOnChan(client->user, header->chan) && isModeSet(header->chan->modes, 'n')) + client = getChannelBot(header->chan, 0); } va_list arg_list; char sendBuf[MAXLEN]; @@ -152,7 +155,7 @@ static void funcmd_reply(struct funcmd_header_info *header, const char *text, in if (pos < 0 || pos > (MAXLEN - 2)) pos = MAXLEN - 2; sendBuf[pos] = '\n'; sendBuf[pos+1] = '\0'; - write_socket(header->client, sendBuf, pos+1); + write_socket(client, sendBuf, pos+1); } static char* getSetting(struct UserNode *user, struct ChanNode *chan, const char *setting) {