hirc

[archived] IRC client
git clone https://hhvn.uk/hirc
git clone git://hhvn.uk/hirc
Log | Files | Refs

handlers.h (2817B)


      1 /*
      2  * src/data/handle.h from hirc
      3  *
      4  * Copyright (c) 2021-2022 hhvn <dev@hhvn.uk>
      5  *
      6  * Permission to use, copy, modify, and distribute this software for any
      7  * purpose with or without fee is hereby granted, provided that the above
      8  * copyright notice and this permission notice appear in all copies.
      9  *
     10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     17  *
     18  */
     19 
     20 #define HANDLER(func) static void func(struct Server *server, struct History *msg)
     21 HANDLER(handle_ERROR);
     22 HANDLER(handle_PING);
     23 HANDLER(handle_PONG);
     24 HANDLER(handle_JOIN);
     25 HANDLER(handle_PART);
     26 HANDLER(handle_KICK);
     27 HANDLER(handle_QUIT);
     28 HANDLER(handle_NICK);
     29 HANDLER(handle_MODE);
     30 HANDLER(handle_TOPIC);
     31 HANDLER(handle_PRIVMSG);
     32 HANDLER(handle_INVITE);
     33 HANDLER(handle_RPL_WELCOME);
     34 HANDLER(handle_RPL_ISUPPORT);
     35 HANDLER(handle_RPL_CHANNELMODEIS);
     36 HANDLER(handle_RPL_NOTOPIC);
     37 HANDLER(handle_RPL_TOPIC);
     38 HANDLER(handle_RPL_TOPICWHOTIME);
     39 HANDLER(handle_RPL_INVITING);
     40 HANDLER(handle_RPL_NAMREPLY);
     41 HANDLER(handle_RPL_ENDOFNAMES);
     42 HANDLER(handle_RPL_MOTD);
     43 HANDLER(handle_RPL_ENDOFMOTD);
     44 HANDLER(handle_ERR_NOSUCHNICK);
     45 HANDLER(handle_ERR_NICKNAMEINUSE);
     46 HANDLER(handle_RPL_AWAY);
     47 
     48 struct Ignore *ignores = NULL;
     49 struct Handler handlers[] = {
     50 	{ "ERROR",	handle_ERROR			},
     51 	{ "PING", 	handle_PING			},
     52 	{ "PONG",	handle_PONG			},
     53 	{ "JOIN",	handle_JOIN			},
     54 	{ "PART",	handle_PART			},
     55 	{ "KICK",	handle_KICK			},
     56 	{ "QUIT",	handle_QUIT			},
     57 	{ "NICK",	handle_NICK			},
     58 	{ "MODE",	handle_MODE			},
     59 	{ "TOPIC",	handle_TOPIC			},
     60 	{ "PRIVMSG",	handle_PRIVMSG  		},
     61 	{ "NOTICE",	handle_PRIVMSG	  		},
     62 	{ "INVITE",	handle_INVITE			},
     63 	{ "001",	handle_RPL_WELCOME		},
     64 	{ "005",	handle_RPL_ISUPPORT		},
     65 	{ "301",	handle_RPL_AWAY			},
     66 	{ "324",	handle_RPL_CHANNELMODEIS	},
     67 	{ "331",	handle_RPL_NOTOPIC		},
     68 	{ "329",	NULL				}, /* ignore this:
     69 							    *  - it's nonstandard
     70 							    *  - hirc has no use for it currently
     71 							    *  - it's annoyingly sent after MODE */
     72 	{ "332",	handle_RPL_TOPIC		},
     73 	{ "333",	handle_RPL_TOPICWHOTIME		},
     74 	{ "341",	handle_RPL_INVITING		},
     75 	{ "353",	handle_RPL_NAMREPLY		},
     76 	{ "366",	handle_RPL_ENDOFNAMES		},
     77 	{ "372",	handle_RPL_MOTD			},
     78 	{ "375",	handle_RPL_MOTD			}, /* RPL_MOTDSTART, but handle it the same way as RPL_MOTD */
     79 	{ "376",	handle_RPL_ENDOFMOTD		},
     80 	{ "401",	handle_ERR_NOSUCHNICK		},
     81 	{ "433",	handle_ERR_NICKNAMEINUSE	},
     82 	{ NULL,		NULL 				},
     83 };