message.email renamed to message.domain
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Tue, 23 Feb 2010 11:04:52 +0100
changeset 48 34094173351c
parent 47 a689b6a8e6ed
child 49 59b09b0aeb96
message.email renamed to message.domain The struct field "email" is not an email, it's the "domain" of the admin user. committer: Markus Bröker <mbroeker@largo.homelinux.org>
INSTALL
include/irc.h
src/irc.c
src/parse.c
--- a/INSTALL
+++ b/INSTALL
@@ -17,7 +17,7 @@
 STEP 4)
 	dbtool -a -k mcbot.cgi -v http://your.domain.com/cgi-bin/mcbot.cgi
 	dbtool -a -k mcbot.user -v <admin nick>         # mbroeker
-	dbtool -a -k mcbot.email -v <admin-hostmask>    # pppool.de
+	dbtool -a -k mcbot.domain -v <admin-domain> # pppool.de
 
 STEP 5)
 	Check your locale settings in /etc/init.d/mcbot
--- a/include/irc.h
+++ b/include/irc.h
@@ -15,7 +15,7 @@
     FILE *stream;
     char *nick;
     char *user;
-    char *email;
+    char *domain;
     char *command;
     char *channel;
     char *line;
--- a/src/irc.c
+++ b/src/irc.c
@@ -169,7 +169,7 @@
     else
         garbage_collector = theLine;
 
-    message->user = message->email = NULL;
+    message->user = message->domain = NULL;
     message->command = NULL;
     message->channel = message->line = NULL;
 
@@ -253,8 +253,8 @@
                         *ptr = '\0';
                     return command;
                 case PRIVMSG:
-                    if ((message->email = strchr (message->user, '@')))
-                        ++message->email;
+                    if ((message->domain = strchr (message->user, '@')))
+                        ++message->domain;
                     if ((ptr = strchr (message->user, '!')))
                         *ptr = '\0';
 
--- a/src/parse.c
+++ b/src/parse.c
@@ -85,8 +85,8 @@
      */
     if (message->user == NULL)
         message->user = "error";
-    if (message->email == NULL)
-        message->email = "server.err";
+    if (message->domain == NULL)
+        message->domain = "server.err";
 
     /*
      * default message
@@ -123,7 +123,7 @@
             case JOIN:
                 if ((token = strtok (NULL, "\r\n")))
                     if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) {
-                        if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        if (strstr (message->domain, db_lookup (DATABASE_FILE, "mcbot.domain")))
                             snprintf (msg, sizeof (msg), "JOIN %s\r\n", token);
                     }
                 return msg;
@@ -132,7 +132,7 @@
                 if (*message->channel != '#')
                     return NULL;
                 if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) {
-                    if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                    if (strstr (message->domain, db_lookup (DATABASE_FILE, "mcbot.domain")))
                         snprintf (msg, sizeof (msg), "PART %s :Leaving.\r\n", message->channel);
                 }
                 return msg;
@@ -209,8 +209,8 @@
                 return msg;
 
             case DEBUG:
-                snprintf (msg, sizeof (msg), "PRIVMSG %s :USER: %s EMAIL: %s CHANNEL: %s LINE: %s\r\n",
-                          message->channel, message->user, message->email, message->channel, message->line);
+                snprintf (msg, sizeof (msg), "PRIVMSG %s :USER: %s domain: %s CHANNEL: %s LINE: %s\r\n",
+                          message->channel, message->user, message->domain, message->channel, message->line);
                 return msg;
 
             case VACCUUM:
@@ -219,7 +219,7 @@
 
             case LOGOUT:
                 if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) {
-                    if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) {
+                    if (strstr (message->domain, db_lookup (DATABASE_FILE, "mcbot.domain"))) {
                         snprintf (msg, sizeof (msg), "PRIVMSG %s :%s!\r\nQUIT\r\n", message->channel,
                                   gettext ("Bye, have a nice day!"));
                     }
@@ -266,7 +266,7 @@
             case OP:
                 if ((token = strtok (NULL, "\r\n")) != NULL) {
                     if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) {
-                        if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        if (strstr (message->domain, db_lookup (DATABASE_FILE, "mcbot.domain")))
                             snprintf (msg, sizeof (msg), "MODE %s +o %s\r\n", message->channel, token);
                     }
                 }
@@ -275,7 +275,7 @@
             case DEOP:
                 if ((token = strtok (NULL, "\r\n")) != NULL) {
                     if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) {
-                        if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        if (strstr (message->domain, db_lookup (DATABASE_FILE, "mcbot.domain")))
                             snprintf (msg, sizeof (msg), "MODE %s -o %s\r\n", message->channel, token);
                     }
                 }
@@ -284,7 +284,7 @@
             case KICK:
                 if ((token = strtok (NULL, "\r\n")) != NULL) {
                     if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) {
-                        if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        if (strstr (message->domain, db_lookup (DATABASE_FILE, "mcbot.domain")))
                             snprintf (msg, sizeof (msg), "KICK %s %s\r\n", message->channel, token);
                     }
                 }
@@ -293,7 +293,7 @@
             case BAN:
                 if ((token = strtok (NULL, "\r\n")) != NULL) {
                     if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) {
-                        if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        if (strstr (message->domain, db_lookup (DATABASE_FILE, "mcbot.domain")))
                             snprintf (msg, sizeof (msg), "MODE %s +b %s\r\n", message->channel, token);
                     }
                 }
@@ -302,7 +302,7 @@
             case UNBAN:
                 if ((token = strtok (NULL, "\r\n")) != NULL) {
                     if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) {
-                        if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        if (strstr (message->domain, db_lookup (DATABASE_FILE, "mcbot.domain")))
                             snprintf (msg, sizeof (msg), "MODE %s -b %s\r\n", message->channel, token);
                     }
                 }
@@ -311,7 +311,7 @@
             case KICKBAN:
                 if ((token = strtok (NULL, "\r\n")) != NULL) {
                     if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) {
-                        if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
+                        if (strstr (message->domain, db_lookup (DATABASE_FILE, "mcbot.domain")))
                             snprintf (msg, sizeof (msg), "MODE %s +b %s\r\nKICK %s %s\r\n", message->channel, token,
                                       message->channel, token);
                     }