From: pk910 Date: Sun, 2 Oct 2011 16:31:37 +0000 (+0200) Subject: use low priority bot if there is no preferred one X-Git-Tag: v5.3~347 X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=8780c4048d2b31f31f01e792f1efbb35537177e3 use low priority bot if there is no preferred one --- diff --git a/src/modcmd.c b/src/modcmd.c index 5476d5e..4b1d2cc 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -53,12 +53,16 @@ static int get_binds_index(char first_char) { } struct ClientSocket* get_prefered_bot(int botid) { - struct ClientSocket *client; + struct ClientSocket *client, *lowbot = NULL; for(client = getBots(SOCKET_FLAG_READY, NULL); client; client = getBots(SOCKET_FLAG_READY, client)) { - if(client->botid == botid && (client->flags & SOCKET_FLAG_PREFERRED)) - return client; + if(client->botid == botid) { + if((client->flags & SOCKET_FLAG_PREFERRED)) + return client; + else + lowbot = client; + } } - return NULL; + return lowbot; } static char* get_channel_trigger(int botid, struct ChanNode *chan) {