From 8780c4048d2b31f31f01e792f1efbb35537177e3 Mon Sep 17 00:00:00 2001 From: pk910 Date: Sun, 2 Oct 2011 18:31:37 +0200 Subject: [PATCH] use low priority bot if there is no preferred one --- src/modcmd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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) { -- 2.20.1