# HG changeset patch
# User Markus Bröker <mbroeker@largo.dyndns.tv>
# Date 1243512528 -7200
# Node ID 85891f91096cd05ebbe4d2d2cf30ffd7e356a62c
# Parent  6889aacd038eecab99d250626428492ba49535e3
enumerated types for irc.c

The irc section gets an enumerated type for constant values.
This makes the code more readable and less error prone.

committer: Markus Bröker <mbroeker@largo.homelinux.org>

diff --git a/src/irc.c b/src/irc.c
--- a/src/irc.c
+++ b/src/irc.c
@@ -21,7 +21,7 @@
 #include <irc.h>
 #include "common.h"
 
-enum {
+enum command_map {
     NOTICE, MODE, JOIN, PART, TOPIC, PING, ENOMEM, ERROR, VERSION, PRIVMSG, QUIT, NICK, KICK
 };
 
@@ -189,16 +189,16 @@
  */
 char *irc_parsemessage (const char *line, MSG * message)
 {
-    int i;
+    enum command_map map;
     char *command;
     char *ptr;
     int value;
 
-    i = 0;
+    map = 0;
     if ((command = irc_getmessage (line, message)) != NULL) {
-        while (IRC_Commands[i] != NULL) {
-            if (strcmp (IRC_Commands[i], command) == 0) {
-                switch (i) {
+        while (IRC_Commands[map] != NULL) {
+            if (strcmp (IRC_Commands[map], command) == 0) {
+                switch (map) {
                 case NOTICE:
                     if (message->line == NULL) {
                         message->channel = "*";
@@ -270,7 +270,7 @@
                     return command;
                 }
             }
-            i++;
+            map++;
         }
 
         if ((value = atoi (command)) != 0) {