src/parse.c
changeset 3 a82a978f23f7
parent 0 586472add385
child 8 3152de03758e
--- a/src/parse.c
+++ b/src/parse.c
@@ -135,9 +135,8 @@
                         snprintf (msg, 512, "PRIVMSG %s :%s, %s\r\n",
                                   message->channel, message->user, db_insert (DATABASE_FILE, token, parameters, 0));
                     } else {
-                        snprintf (msg, 512,
-                                  "PRIVMSG %s :%s, %s!\r\n",
-                                  message->channel, gettext ("I need more parameters to add"), message->user);
+                        snprintf (msg, 512, "PRIVMSG %s :%s, %s!\r\n", message->channel,
+                                  gettext ("I need more parameters to add"), message->user);
                     }
                 }
                 return msg;
@@ -148,9 +147,8 @@
                         snprintf (msg, 512, "PRIVMSG %s :%s, %s\r\n",
                                   message->channel, message->user, db_insert (DATABASE_FILE, token, parameters, 1));
                     } else {
-                        snprintf (msg, 512,
-                                  "PRIVMSG %s :%s, %s!\r\n",
-                                  message->channel, gettext ("I need more parameters to replace"), message->user);
+                        snprintf (msg, 512, "PRIVMSG %s :%s, %s!\r\n", message->channel,
+                                  gettext ("I need more parameters to replace"), message->user);
                     }
                 }
                 return msg;
@@ -160,31 +158,29 @@
                     snprintf (msg, 512, "PRIVMSG %s :%s, %s\r\n",
                               message->channel, message->user, db_remove (DATABASE_FILE, token));
                 } else {
-                    snprintf (msg, 512,
-                              "PRIVMSG %s :%s, %s!\r\n",
-                              message->channel, gettext ("I need a key to delete"), message->user);
+                    snprintf (msg, 512, "PRIVMSG %s :%s, %s!\r\n", message->channel, gettext ("I need a key to delete"),
+                              message->user);
                 }
                 return msg;
 
             case 6:            /* !count */
-                snprintf (msg, 512, "PRIVMSG %s :%s %s\r\n", message->channel,
-                          db_elements (DATABASE_FILE), db_lookup(DATABASE_FILE, "mcbot.cgi"));
+                snprintf (msg, 512, "PRIVMSG %s :%s %s\r\n", message->channel, db_elements (DATABASE_FILE),
+                          db_lookup (DATABASE_FILE, "mcbot.cgi"));
                 return msg;
 
             case 7:            /* !search */
                 if ((token = strtok (NULL, "\r\n"))) {
-                    snprintf (msg, 512, "PRIVMSG %s :%s, %s\r\n",
-                              message->channel, message->user, db_lookup (DATABASE_FILE, token));
+                    snprintf (msg, 512, "PRIVMSG %s :%s, %s\r\n", message->channel, message->user,
+                              db_lookup (DATABASE_FILE, token));
                 } else {
                     snprintf (msg, 512,
-                              "PRIVMSG %s :%s, %s!\r\n",
-                              message->channel, gettext ("I need a key to lookup"), message->user);
+                              "PRIVMSG %s :%s, %s!\r\n", message->channel, gettext ("I need a key to lookup"),
+                              message->user);
                 }
                 return msg;
 
             case 8:            /* !info */
-                snprintf (msg, 512,
-                          "PRIVMSG %s :I am MCBot-%1.2f and my source code can be found on %s\r\n",
+                snprintf (msg, 512, "PRIVMSG %s :I am MCBot-%1.2f and my source code can be found on %s\r\n",
                           message->channel, VERSION, "http://largo.homelinux.org/svn/c/mcbot/trunk");
                 return msg;
 
@@ -194,21 +190,18 @@
                 return msg;
 
             case 10:           /* !on */
-                snprintf (msg, 512,
-                          "PRIVMSG %s :%s %s.\r\n",
-                          message->user, gettext ("Autolearn enabled for channel"), message->channel);
+                snprintf (msg, 512, "PRIVMSG %s :%s %s.\r\n", message->user, gettext ("Autolearn enabled for channel"),
+                          message->channel);
                 return msg;
 
             case 11:           /* !off */
-                snprintf (msg, 512,
-                          "PRIVMSG %s :%s %s.\r\n",
-                          message->user, gettext ("Autolearn disabled for channel"), message->channel);
+                snprintf (msg, 512, "PRIVMSG %s :%s %s.\r\n", message->user, gettext ("Autolearn disabled for channel"),
+                          message->channel);
                 return msg;
 
             case 12:           /* !debug */
-                snprintf (msg, 512,
-                          "PRIVMSG %s :USER: %s EMAIL: %s CHANNEL: %s LINE: %s\r\n",
-                          message->channel, message->user, message->email, message->channel, message->line);
+                snprintf (msg, 512, "PRIVMSG %s :USER: %s EMAIL: %s CHANNEL: %s LINE: %s\r\n", message->channel,
+                          message->user, message->email, message->channel, message->line);
                 return msg;
 
             case 13:           /* !vaccum */
@@ -216,10 +209,10 @@
                 return msg;
 
             case 14:           /* !logout */
-                if (strstr (message->user, db_lookup(DATABASE_FILE, "mcbot.user"))) {
-                    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!"));
+                if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) {
+                    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;
                     }
                 }
@@ -233,42 +226,40 @@
                     snprintf (msg, 512, "WHO %s\r\n", token);
                 }
                 return msg;
-                break;
 
             case 16:           /* !whois */
                 if ((token = strtok (NULL, "\r\n")) != NULL) {
                     snprintf (msg, 512, "WHOIS %s\r\n", token);
                 }
                 return msg;
-                break;
+
             case 17:           /* time */
                 t = time (NULL);
                 timeptr = localtime (&t);
                 if ((token = malloc (81))) {
                     strftime (token, 80, "%I:%M:%S %p", timeptr);
-                    snprintf (msg, 512, "PRIVMSG %s :%s %s, %s!\r\n",
-                              message->channel, gettext ("It is"), token, message->user);
+                    snprintf (msg, 512, "PRIVMSG %s :%s %s, %s!\r\n", message->channel, gettext ("It is"), token,
+                              message->user);
                     free (token);
                 }
                 return msg;
-                break;
+
             case 18:           /* tell */
                 if ((token = strtok (NULL, " "))) {
                     if ((parameters = strtok (NULL, "\r\n"))) {
                         snprintf (msg, 512, "PRIVMSG %s :%s, %s\r\n",
-                                  (*token ==
-                                   '*') ? ++token : message->channel, token, db_lookup (DATABASE_FILE, parameters));
+                                  ('*' == *token) ? ++token : message->channel, token, db_lookup (DATABASE_FILE,
+                                                                                                  parameters));
                     }
                 }
                 return msg;
-                break;
+
             case 19:           /* op */
                 if ((token = strtok (NULL, "\r\n")) != NULL) {
-                    if (strstr (message->email, db_lookup(DATABASE_FILE, "mcbot.email")))
+                    if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email")))
                         snprintf (msg, 512, "MODE %s +o %s\r\n", message->channel, token);
                 }
                 return msg;
-                break;
             }
         }
         i++;