A critical change was introduced here...
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 15:38:49 +0100
changeset 8 3152de03758e
parent 7 b04ef0b1cd3b
child 9 aff6726b8b87
A critical change was introduced here... After securing the runtime behaviour 2 commits ago by inserting a feof(stream) { ... } there is no need for short active = 0|1 anymore. committer: Markus Bröker <mbroeker@largo.homelinux.org>
include/mcbot.h
src/main.c
src/parse.c
--- a/include/mcbot.h
+++ b/include/mcbot.h
@@ -15,5 +15,5 @@
 #include <irc.h>
 #endif
 
-char *parse (MSG *, short *);
+char *parse (MSG *);
 #endif
--- a/src/main.c
+++ b/src/main.c
@@ -29,12 +29,9 @@
 #define LOCALE_PATH "/var/lib/nobody/data/locale"
 #endif
 
-short active = 1;
-
 void sigproc ()
 {
     signal (SIGTERM, sigproc);
-    active = 0;
 }
 
 int main (int argc, char **argv)
@@ -105,7 +102,7 @@
         if ((command = irc_parsemessage (buf, &message))) {
             printf ("%10s %s %s\n", command, message.channel, message.line);
         } else {
-            if ((msg = parse (&message, &active)) != NULL) {
+            if ((msg = parse (&message)) != NULL) {
                 fprintf (message.stream, "%s\r\n", msg);
                 printf ("%10s %s", "WRITE", msg);
             }
--- a/src/parse.c
+++ b/src/parse.c
@@ -54,7 +54,7 @@
     NULL,
 };
 
-char *parse (MSG * message, short *active)
+char *parse (MSG * message)
 {
     static char msg[513];
     int cmd = -1;
@@ -213,7 +213,6 @@
                     if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) {
                         snprintf (msg, 512, "PRIVMSG %s :%s!\r\nQUIT\r\n", message->channel,
                                   gettext ("Bye, have a nice day!"));
-                        *active = 0;
                     }
                 }
                 /*