-/* cmd_neonserv_extscript.c - NeonServ v5.2
- * Copyright (C) 2011 Philipp Kreil (pk910)
+/* cmd_neonserv_extscript.c - NeonServ v5.3
+ * Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
struct neonserv_cmd_extscript_cache {
struct ClientSocket *client, *textclient;
+ struct Event *event;
struct UserNode *user;
struct ChanNode *chan;
int answere_channel;
}
cache->client = client;
cache->textclient = getTextBot();
+ cache->event = event;
cache->user = user;
cache->chan = chan;
cache->answere_channel = answere_channel;
cache->pipe = popen(command, "r");
+ #ifndef WIN32
fcntl(fileno(cache->pipe), F_SETFL, O_NONBLOCK);
- timeq_add(1, neonserv_cmd_extscript_callback, cache);
+ #endif
+ timeq_uadd(200, neonserv_cmd_extscript_callback, cache);
}
static TIMEQ_CALLBACK(neonserv_cmd_extscript_callback) {
while (fgets(command, 512, cache->pipe) != NULL) {
if((a = strchr(command, '\n')))
*a = '\0';
+ if(!stricmp(command, "/log")) {
+ logEvent(cache->event);
+ continue;
+ }
if(cache->answere_channel)
putsock(cache->client, "PRIVMSG %s :%s", cache->chan->name, command);
else
reply(cache->textclient, cache->user, "%s", command);
}
- timeq_add(1, neonserv_cmd_extscript_callback, cache);
+ timeq_uadd(200, neonserv_cmd_extscript_callback, cache);
}