cache->textclient = getTextBot();
cache->user = user;
cache->duration = duration;
- cache->who_count = 0;
+ cache->who_count = 1; /* small fake to prevent the cache to be freed too early */
cache->matches = 0;
printf_mysql_query("SELECT `channel_id`, `channel_name`, `channel_nodelete` FROM `bot_channels` LEFT JOIN `channels` ON `chanid` = `channel_id` LEFT JOIN `users` ON `channel_registrator` = `user_id` WHERE `botid` = '%d'", client->botid);
res = mysql_use();
if(!strcmp(row[2], "1")) continue;
printf_mysql_query("SELECT `chanuser_seen` FROM `chanusers` WHERE `chanuser_cid` = '%s' AND `chanuser_access` >= 300 ORDER BY `chanuser_seen` DESC LIMIT 1", row[0]);
res2 = mysql_use();
- row2 = mysql_fetch_row(res);
+ row2 = mysql_fetch_row(res2);
if(row2 && atol(row2[0]) > (time(0) - duration)) continue;
channel = getChanByName(row[1]);
if(channel) {
cache->matches++;
}
}
+ cache->who_count--; //see fix on line 46
if(cache->who_count == 0) {
neonserv_cmd_unvisited_async2(cache);
}