#include "DBHelper.h"
#include "BanNode.h"
#include "ModeNode.h"
+#include "tools.h"
struct irc_cmd *irc_commands = NULL;
static struct UserNode *registering_users = NULL;
event_join(chanuser);
}
-static IRC_CMD(raw_001) {
+static IRC_CMD(raw_002) { //fixed: ZNC fakes a 001 raw even if we're not connected!
struct UserNode *user = getUserByNick(argv[0]);
if(!user)
user = addUser(argv[0]);
if(from == NULL || argc < 1) return 0;
struct UserNode *user = getUserByMask(from);
struct ChanNode *chan = getChanByName(argv[0]);
- if(!chan && !(user->flags & USERFLAG_ISBOT)) return 0;
+ if(!chan && (!user || !(user->flags & USERFLAG_ISBOT))) return 0;
if(chan && (((!user || !isBot(user)) && chan->chanbot != client->user) || ((user && isBot(user)) && client->user != user))) return 1; //we ignore it - but it's not a parse error
//let Bots always add themselves! (maybe they join invisible)
if(user == NULL) {
struct UserNode *target = getUserByNick(argv[1]);
struct ChanNode *chan = getChanByName(argv[0]);
if(chan == NULL || target == NULL) return 0;
- if(((!isBot(user) && chan->chanbot != client->user) || (isBot(user) && client->user != user))) return 1; //we ignore it - but it's not a parse error
+ if(((!isBot(target) && chan->chanbot != client->user) || (isBot(target) && client->user != target))) return 1; //we ignore it - but it's not a parse error
int keep_channel = 1;
if(isUserOnChan(target, chan) && (chan->flags & CHANFLAG_RECEIVED_USERLIST)) {
if(user == NULL) {
user = createTempUser(from);
user->flags |= USERFLAG_ISTMPUSER;
}
+ if(!stricmp(user->nick, "*status") && !match("Disconnected from IRC.*", argv[1])) {
+ //ZNC DISCONNECT
+ bot_disconnect(client);
+ return 1;
+ }
+ if(!stricmp(user->nick, "-sBNC") && !match("* disconnected from the server.", argv[1])) {
+ //sBNC DISCONNECT
+ bot_disconnect(client);
+ return 1;
+ }
if(argv[0][0] == '#') { //Channel message
struct ChanNode *chan = getChanByName(argv[0]);
if(chan && chan->chanbot == client->user) {
void init_parser() {
//all the raws we receive...
- register_irc_function("001", raw_001);
+ register_irc_function("002", raw_002);
register_irc_function("251", raw_251);
register_irc_function("254", raw_254);
register_irc_function("324", raw_324);