src/irc_net.c
changeset 68 591a574f390e
parent 63 d399a1d915a3
child 72 43084f103c2a
equal deleted inserted replaced
67:aa94bf2b5f9b 68:591a574f390e
   106     
   106     
   107     irc_net_propagate_chan(net, line, line->args[0]);
   107     irc_net_propagate_chan(net, line, line->args[0]);
   108 }
   108 }
   109 
   109 
   110 /**
   110 /**
   111  * :nm PRIVMSG <target> <message>
   111  * :nm (PRIVMSG|NOTICE) <target> <message>
   112  *
   112  *
   113  * Either propagate to channel if found, otherwise handle as a privmsg
   113  * Either propagate to channel if found, otherwise handle as a privmsg
   114  */
   114  */
   115 static void irc_net_on_PRIVMSG (const struct irc_line *line, void *arg)
   115 static void irc_net_on_msg (const struct irc_line *line, void *arg)
   116 {
   116 {
   117     struct irc_net *net = arg;
   117     struct irc_net *net = arg;
   118 
   118 
   119     // XXX: does two lookups
   119     // XXX: does two lookups
   120     if (irc_net_get_chan(net, line->args[0])) {
   120     if (irc_net_get_chan(net, line->args[0])) {
   130 /**
   130 /**
   131  * Our irc_cmd handler list
   131  * Our irc_cmd handler list
   132  */
   132  */
   133 static struct irc_cmd_handler _cmd_handlers[] = {
   133 static struct irc_cmd_handler _cmd_handlers[] = {
   134     {   "JOIN",     &irc_net_on_chan0       },
   134     {   "JOIN",     &irc_net_on_chan0       },
   135     {   "PRIVMSG",  &irc_net_on_PRIVMSG     },
   135     {   "PART",     &irc_net_on_chan0       },
       
   136     {   "MODE",     &irc_net_on_chan0       },
       
   137     {   "TOPIC",    &irc_net_on_chan0       },
       
   138     {   "KICK",     &irc_net_on_chan0       },
       
   139 
       
   140     {   "PRIVMSG",  &irc_net_on_msg         },
       
   141     {   "NOTICE",   &irc_net_on_msg         },
       
   142 
       
   143     // XXX: NICK/QUIT
       
   144 
   136     {   NULL,       NULL                    }
   145     {   NULL,       NULL                    }
   137 };
   146 };
   138 
   147 
   139 err_t irc_net_create (struct irc_net **net_ptr, const struct irc_net_info *info, struct error_info *err)
   148 err_t irc_net_create (struct irc_net **net_ptr, const struct irc_net_info *info, struct error_info *err)
   140 {
   149 {