| 48 |
48 |
| 49 /*typedef void (*IRCMsgCallback)(struct irc_conn *irc, char *from, char *name, char **args);*/ |
49 /*typedef void (*IRCMsgCallback)(struct irc_conn *irc, char *from, char *name, char **args);*/ |
| 50 static struct _irc_msg { |
50 static struct _irc_msg { |
| 51 char *name; |
51 char *name; |
| 52 char *format; |
52 char *format; |
| 53 int req_cnt; |
53 /* The required parameters count, based on values we use, not protocol |
| |
54 * specification. */ |
| |
55 int req_cnt; |
| 54 void (*cb)(struct irc_conn *irc, const char *name, const char *from, char **args); |
56 void (*cb)(struct irc_conn *irc, const char *name, const char *from, char **args); |
| 55 } _irc_msgs[] = { |
57 } _irc_msgs[] = { |
| 56 { "005", "n*", -1, irc_msg_features }, /* Feature list */ |
58 { "005", "n*", 2, irc_msg_features }, /* Feature list */ |
| 57 { "251", "n:", -1, irc_msg_luser }, /* Client & Server count */ |
59 { "251", "n:", 1, irc_msg_luser }, /* Client & Server count */ |
| 58 { "255", "n:", -1, irc_msg_luser }, /* Client & Server count Mk. II */ |
60 { "255", "n:", 1, irc_msg_luser }, /* Client & Server count Mk. II */ |
| 59 { "301", "nn:", -1, irc_msg_away }, /* User is away */ |
61 { "301", "nn:", 3, irc_msg_away }, /* User is away */ |
| 60 { "303", "n:", -1, irc_msg_ison }, /* ISON reply */ |
62 { "303", "n:", 2, irc_msg_ison }, /* ISON reply */ |
| 61 { "311", "nnvvv:", -1, irc_msg_whois }, /* Whois user */ |
63 { "311", "nnvvv:", 6, irc_msg_whois }, /* Whois user */ |
| 62 { "312", "nnv:", -1, irc_msg_whois }, /* Whois server */ |
64 { "312", "nnv:", 4, irc_msg_whois }, /* Whois server */ |
| 63 { "313", "nn:", -1, irc_msg_whois }, /* Whois ircop */ |
65 { "313", "nn:", 2, irc_msg_whois }, /* Whois ircop */ |
| 64 { "317", "nnvv", -1, irc_msg_whois }, /* Whois idle */ |
66 { "317", "nnvv", 4, irc_msg_whois }, /* Whois idle */ |
| 65 { "318", "nt:", -1, irc_msg_endwhois }, /* End of WHOIS */ |
67 { "318", "nt:", 2, irc_msg_endwhois }, /* End of WHOIS */ |
| 66 { "319", "nn:", -1, irc_msg_whois }, /* Whois channels */ |
68 { "319", "nn:", 3, irc_msg_whois }, /* Whois channels */ |
| 67 { "320", "nn:", -1, irc_msg_whois }, /* Whois (fn ident) */ |
69 { "320", "nn:", 2, irc_msg_whois }, /* Whois (fn ident) */ |
| 68 { "314", "nnnvv:", -1, irc_msg_whois }, /* Whowas user */ |
70 { "314", "nnnvv:", 6, irc_msg_whois }, /* Whowas user */ |
| 69 { "315", "nt:", -1, irc_msg_who }, /* end of WHO channel */ |
71 { "315", "nt:", 0, irc_msg_who }, /* end of WHO channel */ |
| 70 { "369", "nt:", -1, irc_msg_endwhois }, /* End of WHOWAS */ |
72 { "369", "nt:", 2, irc_msg_endwhois }, /* End of WHOWAS */ |
| 71 { "321", "*", -1, irc_msg_list }, /* Start of list */ |
73 { "321", "*", 0, irc_msg_list }, /* Start of list */ |
| 72 { "322", "ncv:", -1, irc_msg_list }, /* List. */ |
74 { "322", "ncv:", 4, irc_msg_list }, /* List. */ |
| 73 { "323", ":", -1, irc_msg_list }, /* End of list. */ |
75 { "323", ":", 0, irc_msg_list }, /* End of list. */ |
| 74 { "324", "ncv:", -1, irc_msg_chanmode }, /* Channel modes */ |
76 { "324", "ncv:", 3, irc_msg_chanmode }, /* Channel modes */ |
| 75 { "331", "nc:", 3, irc_msg_topic }, /* No channel topic */ |
77 { "331", "nc:", 3, irc_msg_topic }, /* No channel topic */ |
| 76 { "332", "nc:", 3, irc_msg_topic }, /* Channel topic */ |
78 { "332", "nc:", 3, irc_msg_topic }, /* Channel topic */ |
| 77 { "333", "ncvv", -1, irc_msg_topicinfo }, /* Topic setter stuff */ |
79 { "333", "ncvv", 4, irc_msg_topicinfo }, /* Topic setter stuff */ |
| 78 { "352", "ncvvvnv:", -1, irc_msg_who }, /* Channel WHO */ |
80 { "352", "ncvvvnv:", 8, irc_msg_who }, /* Channel WHO */ |
| 79 { "353", "nvc:", -1, irc_msg_names }, /* Names list */ |
81 { "353", "nvc:", 4, irc_msg_names }, /* Names list */ |
| 80 { "366", "nc:", -1, irc_msg_names }, /* End of names */ |
82 { "366", "nc:", 2, irc_msg_names }, /* End of names */ |
| 81 { "367", "ncnnv", -1, irc_msg_ban }, /* Ban list */ |
83 { "367", "ncnnv", 3, irc_msg_ban }, /* Ban list */ |
| 82 { "368", "nc:", -1, irc_msg_ban }, /* End of ban list */ |
84 { "368", "nc:", 2, irc_msg_ban }, /* End of ban list */ |
| 83 { "372", "n:", 1, irc_msg_motd }, /* MOTD */ |
85 { "372", "n:", 1, irc_msg_motd }, /* MOTD */ |
| 84 { "375", "n:", 1, irc_msg_motd }, /* Start MOTD */ |
86 { "375", "n:", 1, irc_msg_motd }, /* Start MOTD */ |
| 85 { "376", "n:", 1, irc_msg_motd }, /* End of MOTD */ |
87 { "376", "n:", 1, irc_msg_motd }, /* End of MOTD */ |
| 86 { "391", "nv:", 3, irc_msg_time }, /* Time reply */ |
88 { "391", "nv:", 3, irc_msg_time }, /* Time reply */ |
| 87 { "401", "nt:", 2, irc_msg_nonick }, /* No such nick/chan */ |
89 { "401", "nt:", 2, irc_msg_nonick }, /* No such nick/chan */ |