]> PatchyGit - patchyircd.git/commitdiff
s/client_data/Client/g;s/channel/Channel/g
authorEgor <egor@patchysicp.xyz>
Fri, 13 Jun 2025 06:19:58 +0000 (09:19 +0300)
committerEgor <egor@patchysicp.xyz>
Fri, 13 Jun 2025 06:19:58 +0000 (09:19 +0300)
capitalization to avoid shadowing issues

13 files changed:
src/admin.cpp
src/admin.hpp
src/common.hpp
src/irc.cpp
src/irc.hpp
src/ircfmt.cpp
src/ircfmt.hpp
src/job.cpp
src/job.hpp
src/main.cpp
src/map.hpp
src/net.cpp
src/net.hpp

index ff93fa0..ff99133 100644 (file)
@@ -25,11 +25,11 @@ static int map_index(lua_State *L)
                lua_pushvalue(L, 2);
                return 1;
        case MAPTYPE_CLIENT:
-               *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = (struct client_data *)value;
+               *(Client **)lua_newuserdatauv(L, sizeof(Client *), 0) = (Client *)value;
                luaL_setmetatable(L, "client");
                return 1;
        case MAPTYPE_CHANNEL:
-               *(struct channel **)lua_newuserdatauv(L, sizeof(struct channel *), 0) = (struct channel *)value;
+               *(Channel **)lua_newuserdatauv(L, sizeof(Channel *), 0) = (Channel *)value;
                luaL_setmetatable(L, "channel");
                return 1;
        }
@@ -77,12 +77,12 @@ static int map_iter_next(lua_State *L)
                return 2;
        case MAPTYPE_CLIENT:
                lua_pushstring(L, key);
-               *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = (struct client_data *)value;
+               *(Client **)lua_newuserdatauv(L, sizeof(Client *), 0) = (Client *)value;
                luaL_setmetatable(L, "client");
                return 2;
        case MAPTYPE_CHANNEL:
                lua_pushstring(L, key);
-               *(struct channel **)lua_newuserdatauv(L, sizeof(struct channel *), 0) = (struct channel *)value;
+               *(Channel **)lua_newuserdatauv(L, sizeof(Channel *), 0) = (Channel *)value;
                luaL_setmetatable(L, "channel");
                return 2;
        }
@@ -110,7 +110,7 @@ static void map_push(lua_State *L, map_base *map, int type)
 }
 static int client_index(lua_State *L)
 {
-       struct client_data *cl = *(struct client_data **)luaL_checkudata(L, 1, "client");
+       Client *cl = *(Client **)luaL_checkudata(L, 1, "client");
        const char *key = luaL_checkstring(L, 2);
        if (!cl)
                return 0;
@@ -122,7 +122,7 @@ static int client_index(lua_State *L)
        if (!strcmp(key, "next")) {
                if (!cl->next)
                        return 0;
-               *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = cl->next;
+               *(Client **)lua_newuserdatauv(L, sizeof(Client *), 0) = cl->next;
                luaL_setmetatable(L, "client");
                return 1;
        }
@@ -167,7 +167,7 @@ static int client_index(lua_State *L)
 }
 static int channel_index(lua_State *L)
 {
-       struct channel *chan = *(struct channel **)luaL_checkudata(L, 1, "channel");
+       Channel *chan = *(Channel **)luaL_checkudata(L, 1, "channel");
        const char *key = luaL_checkstring(L, 2);
        if (!chan)
                return 0;
@@ -203,12 +203,12 @@ static int globals_index(lua_State *L)
        if (!strcmp(key, "autojoin"))
                return map_push(L, &autojoin, MAPTYPE_STRINGSET), 1;
        if (!strcmp(key, "clients")) {
-               *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = clients;
+               *(Client **)lua_newuserdatauv(L, sizeof(Client *), 0) = clients;
                luaL_setmetatable(L, "client");
                return 1;
        }
        if (!strcmp(key, "dyingclients")) {
-               *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = dyingclients;
+               *(Client **)lua_newuserdatauv(L, sizeof(Client *), 0) = dyingclients;
                luaL_setmetatable(L, "client");
                return 1;
        }
@@ -225,25 +225,25 @@ static int command_eval(lua_State *L)
 }
 static int fn_client_privmsg(lua_State *L)
 {
-       struct client_data *cl = *(struct client_data **)luaL_checkudata(L, 1, "client");
+       Client *cl = *(Client **)luaL_checkudata(L, 1, "client");
        const char *msg = luaL_checkstring(L, 2);
        msg_privmsg_server(luaL_optstring(L, 3, hostname), cl->nick, msg), sendbuf(cl);
        return 0;
 }
 static int fn_client_notice(lua_State *L)
 {
-       struct client_data *cl = *(struct client_data **)luaL_checkudata(L, 1, "client");
+       Client *cl = *(Client **)luaL_checkudata(L, 1, "client");
        const char *msg = luaL_checkstring(L, 2);
        msg_notice_server(luaL_optstring(L, 3, hostname), cl->nick, msg), sendbuf(cl);
        return 0;
 }
 static int fn_channel_join(lua_State *L)
 {
-       struct client_data *cl = *(struct client_data **)luaL_checkudata(L, 1, "client");
+       Client *cl = *(Client **)luaL_checkudata(L, 1, "client");
        const char *channel = 0;
-       struct channel *chan = 0;
+       Channel *chan = 0;
        if (lua_isuserdata(L, 2)) {
-               chan = *(struct channel **)luaL_checkudata(L, 2, "channel");
+               chan = *(Channel **)luaL_checkudata(L, 2, "channel");
                channel = chan->key;
        } else {
                channel = luaL_checkstring(L, 2);
@@ -254,12 +254,12 @@ static int fn_channel_join(lua_State *L)
 }
 static int fn_channel_part(lua_State *L)
 {
-       struct client_data *cl = *(struct client_data **)luaL_checkudata(L, 1, "client");
-       struct channel *chan = *(struct channel **)luaL_checkudata(L, 2, "channel");
+       Client *cl = *(Client **)luaL_checkudata(L, 1, "client");
+       Channel *chan = *(Channel **)luaL_checkudata(L, 2, "channel");
        const char *reason = luaL_optstring(L, 3, 0);
-       struct client_data *kicker = 0;
+       Client *kicker = 0;
        if (lua_isuserdata(L, 4))
-               kicker = *(struct client_data **)luaL_checkudata(L, 4, "client");
+               kicker = *(Client **)luaL_checkudata(L, 4, "client");
        channel_part(cl, chan, reason, kicker);
        return 0;
 }
@@ -273,7 +273,7 @@ static int fn_channel_new(lua_State *L)
        char key[33];
        memcpy(key, channel, chanlen+1);
        stringlower(key);
-       struct channel *chan = channel_map.get(key);
+       Channel *chan = channel_map.get(key);
        if (!chan) {
                chan = channel_new(channel, key, creation ? creation : get_time());
                channel_map.add(chan);
@@ -282,7 +282,7 @@ static int fn_channel_new(lua_State *L)
 }
 static int fn_channel_mode(lua_State *L)
 {
-       struct channel *chan = *(struct channel **)luaL_checkudata(L, 1, "channel");
+       Channel *chan = *(Channel **)luaL_checkudata(L, 1, "channel");
        size_t as, bs;
        const char *a = luaL_checklstring(L, 2, &as);
        const char *b = luaL_optlstring(L, 3, 0, &bs);
@@ -297,7 +297,7 @@ static int fn_channel_mode(lua_State *L)
 }
 static int fn_channel_topic(lua_State *L)
 {
-       struct channel *chan = *(struct channel **)luaL_checkudata(L, 1, "channel");
+       Channel *chan = *(Channel **)luaL_checkudata(L, 1, "channel");
        const char *topic = luaL_checkstring(L, 2);
        const char *who = luaL_checkstring(L, 3);
        time_t when = luaL_optinteger(L, 4, 0);
@@ -306,15 +306,15 @@ static int fn_channel_topic(lua_State *L)
 }
 static int fn_client_chghost(lua_State *L)
 {
-       struct client_data *cl = *(struct client_data **)luaL_checkudata(L, 1, "client");
+       Client *cl = *(Client **)luaL_checkudata(L, 1, "client");
        const char *newusername = luaL_optstring(L, 2, 0);
        const char *newhostname = luaL_optstring(L, 3, 0);
        client_chghost(cl, newusername, newhostname);
        return 0;
 }
 static int fn_rpl_whoisspecial(lua_State *L) {
-       struct client_data *cl1 = *(struct client_data **)luaL_checkudata(L, 1, "client");
-       struct client_data *cl2 = *(struct client_data **)luaL_checkudata(L, 2, "client");
+       Client *cl1 = *(Client **)luaL_checkudata(L, 1, "client");
+       Client *cl2 = *(Client **)luaL_checkudata(L, 2, "client");
        const char *text = luaL_checkstring(L, 3);
        rpl_whoisspecial(cl1, cl2, "", text), sendbuf(cl1);
        return 0;
@@ -417,7 +417,7 @@ void admin_fini(void)
                GL = 0;
        }
 }
-int admin_command(struct client_data *client, char *source, char *command, int argc, char *args[])
+int admin_command(Client *client, char *source, char *command, int argc, char *args[])
 {
        if (!is_registered(client))
                return err_notregistered(client), sendbuf(client), 0;
@@ -437,7 +437,7 @@ int admin_command(struct client_data *client, char *source, char *command, int a
                lua_pop(L, 1);
                return 0;
        }
-       *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = client;
+       *(Client **)lua_newuserdatauv(L, sizeof(Client *), 0) = client;
        luaL_setmetatable(L, "client");
        lua_pushstring(L, source);
        lua_pushstring(L, command);
@@ -454,7 +454,7 @@ int admin_command(struct client_data *client, char *source, char *command, int a
        }
        return 0;
 }
-int admin_hook(const char *hook, struct client_data *cl1, struct client_data *cl2, struct channel *chan, char *txt)
+int admin_hook(const char *hook, Client *cl1, Client *cl2, Channel *chan, char *txt)
 {
        lua_State *L = GL;
        if (lua_getglobal(L, "hooks") != LUA_TTABLE) {
@@ -469,19 +469,19 @@ int admin_hook(const char *hook, struct client_data *cl1, struct client_data *cl
        }
        lua_pushstring(L, hook);
        if (cl1) {
-               *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = cl1;
+               *(Client **)lua_newuserdatauv(L, sizeof(Client *), 0) = cl1;
                luaL_setmetatable(L, "client");
        } else {
                lua_pushnil(L);
        }
        if (cl2) {
-               *(struct client_data **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = cl2;
+               *(Client **)lua_newuserdatauv(L, sizeof(Client *), 0) = cl2;
                luaL_setmetatable(L, "client");
        } else {
                lua_pushnil(L);
        }
        if (chan) {
-               *(struct channel **)lua_newuserdatauv(L, sizeof(struct client_data *), 0) = chan;
+               *(Channel **)lua_newuserdatauv(L, sizeof(Client *), 0) = chan;
                luaL_setmetatable(L, "channel");
        } else {
                lua_pushnil(L);
index f4c03fc..49fe7aa 100644 (file)
@@ -5,7 +5,7 @@
 #ifdef HAVE_LUA
 void admin_init(void);
 void admin_fini(void);
-int admin_command(struct client_data *client, char *source, char *command, int argc, char *args[]);
-int admin_hook(const char *hook, struct client_data *cl1, struct client_data *cl2, struct channel *chan, char *txt);
+int admin_command(Client *client, char *source, char *command, int argc, char *args[]);
+int admin_hook(const char *hook, Client *cl1, Client *cl2, Channel *chan, char *txt);
 #endif
 #endif
index 7140936..060ef0e 100644 (file)
@@ -65,11 +65,11 @@ struct tls;
 #define CAP_CHGHOST 64
 #define CAP_SETNAME 128
 #define CAP_ACCOUNTNOTIFY 256
-struct client_data {
+struct Client {
        char   *key; // case-mapped nick
        uv_os_sock_t fd;
        struct tls *cctx;
-       struct client_data *next;
+       struct Client *next;
        char   *nick;
        char   *username;
        char   *realname;
@@ -110,7 +110,7 @@ struct client_data {
        unsigned passwait :1;
        unsigned webircwait :2;
 };
-struct channel {
+struct Channel {
        char *key;
        char *name;
        char *topic;
@@ -143,6 +143,6 @@ struct channel {
 extern clientmap client_map;
 extern channelmap channel_map;
 extern stringset autojoin;
-extern struct client_data  *clients;
-extern struct client_data  *dyingclients;
+extern Client  *clients;
+extern Client  *dyingclients;
 #endif
index 47a2bbd..c31c30a 100644 (file)
@@ -13,7 +13,7 @@ channelmap channel_map = {};
 stringset autojoin = {};
 
 const char *hostname = 0;
-void sendbuf(struct client_data *client) {
+void sendbuf(Client *client) {
        log_client(client, "SERVER: %.*s", (int)databuf.size(), (char*)databuf.data());
        sendClient(client, databuf.data(), databuf.size());
 }
@@ -30,15 +30,15 @@ static void chanlog(void) {
                fflush(fchanlog);
        }
 }
-static void sendbuf_chan_caps(struct channel *chan, unsigned positive, unsigned negative) {
+static void sendbuf_chan_caps(Channel *chan, unsigned positive, unsigned negative) {
        for (auto cl : chan->members)
                if (!(~cl->caps & positive) && !(cl->caps & negative))
                        sendbuf(cl);
 }
-static void sendbuf_chan(struct channel *chan) {
+static void sendbuf_chan(Channel *chan) {
        sendbuf_chan_caps(chan, 0, 0);
 }
-static void sendbuf_list_sans_self_caps(struct client_data *client, clientmap &ls, int cookie, int positive, int negative) {
+static void sendbuf_list_sans_self_caps(Client *client, clientmap &ls, int cookie, int positive, int negative) {
        for (auto cl : ls)
                if (client != cl) {
                        if (cookie) {
@@ -51,7 +51,7 @@ static void sendbuf_list_sans_self_caps(struct client_data *client, clientmap &l
                                sendbuf(cl);
                }
 }
-static void sendbuf_list_sans_self(struct client_data *client, clientmap &ls, int cookie) {
+static void sendbuf_list_sans_self(Client *client, clientmap &ls, int cookie) {
        sendbuf_list_sans_self_caps(client, ls, cookie, 0, 0);
 }
 void sendbuf_monitor(const char *nick, int cookie, int positive, int negative)
@@ -78,16 +78,16 @@ static int get_cookie(void) {
        }
        return cookie;
 }
-static int sendbuf_visible_caps(struct client_data *client, int positive, int negative) {
+static int sendbuf_visible_caps(Client *client, int positive, int negative) {
        int cookie = get_cookie();
        for (auto chan : client->channels)
                sendbuf_list_sans_self_caps(client, chan->members, cookie, positive, negative);
        return cookie;
 }
-void sendbuf_visible(struct client_data *client) {
+void sendbuf_visible(Client *client) {
        sendbuf_visible_caps(client, 0, 0);
 }
-const char *format_umodes(struct client_data *cl) {
+const char *format_umodes(Client *cl) {
        static char umodes[8] = "";
        char *p = umodes;
        *p++ = '+';
@@ -100,14 +100,14 @@ const char *format_umodes(struct client_data *cl) {
        *p++ = '\0';
        return umodes;
 }
-static int match_list(struct client_data *cl, stringset &list)
+static int match_list(Client *cl, stringset &list)
 {
        for (auto key : list)
                if (irc_glob(cl->nuh, key))
                        return 1;
        return 0;
 }
-int irc_parse_line(struct client_data *client, char *p, char *end) {
+int irc_parse_line(Client *client, char *p, char *end) {
        char *source = NULL;
        char *command = NULL;
        char *args[16] = {0};
@@ -179,7 +179,7 @@ int irc_parse_line(struct client_data *client, char *p, char *end) {
        fprintf(stderr, "\n");
        return irc_process_line(client, source, command, argc, args);
 }
-static void cont_webirc(struct client_data *client, int res) {
+static void cont_webirc(Client *client, int res) {
        if (!(client->umode & UMODE_SECURE) || res != 0) {
                free(client->webircpeername);
                client->webircpeername = 0;
@@ -201,7 +201,7 @@ static void cont_webirc(struct client_data *client, int res) {
                newUser(client);
        }
 }
-static void cont_oper(struct client_data *client, int res) {
+static void cont_oper(Client *client, int res) {
        if (!(client->umode & UMODE_SECURE) || res != 0) {
                err_passwdmismatch(client), sendbuf(client);
        } else {
@@ -211,7 +211,7 @@ static void cont_oper(struct client_data *client, int res) {
                sendbuf(client);
        }
 }
-static void cont_sasl(struct client_data *client, int res) {
+static void cont_sasl(Client *client, int res) {
        if (client->saslusername) {
                if (res == 0) {
                        rpl_saslsuccess(), sendbuf(client);
@@ -224,7 +224,7 @@ static void cont_sasl(struct client_data *client, int res) {
                newUser(client);
        }
 }
-static void cont_pass(struct client_data *client, int res) {
+static void cont_pass(Client *client, int res) {
        if (client->passwait) {
                client->passwait = 0;
                if (!(client->umode & UMODE_SECURE) || res != 0) {
@@ -235,7 +235,7 @@ static void cont_pass(struct client_data *client, int res) {
                newUser(client);
        }
 }
-int irc_process_line(struct client_data *client, char *source, char *command, int argc, char *args[]) {
+int irc_process_line(Client *client, char *source, char *command, int argc, char *args[]) {
        (void)source;
        databuf.clear();
        if(strcmp(command, "") == 0) {
@@ -553,7 +553,7 @@ saslcleanup:
                                        return err_nicknameinuse(client, desired_nick), sendbuf(client), 0;
                        }
                }
-               struct client_data *cl = findClient(desired_nick);
+               Client *cl = findClient(desired_nick);
                if (!cl)
                        return err_nosuchnick(client, desired_nick), sendbuf(client), 0;
                if (client == cl)
@@ -577,7 +577,7 @@ saslcleanup:
                        return err_noprivileges(client), sendbuf(client), 0;
                if (argc < 1)
                        return err_needmoreparams(client, command), sendbuf(client), 0;
-               struct client_data *cl = findClient(args[0]);
+               Client *cl = findClient(args[0]);
                if (!cl)
                        return 0; // FIXME: error message
                if (client == cl)
@@ -595,7 +595,7 @@ saslcleanup:
                        return err_noprivileges(client), sendbuf(client), 0;
                if (argc < 1)
                        return err_needmoreparams(client, command), sendbuf(client), 0;
-               struct channel *chan = findChannel(args[0]);
+               Channel *chan = findChannel(args[0]);
                if (!chan)
                        return err_nosuchchannel(client, args[0]), sendbuf(client), 0;
                if (!chan->members.has(client))
@@ -634,7 +634,7 @@ saslcleanup:
                        char *channel = p;
                        if ((p = strchr(channel, ',')))
                                *p++ = '\0';
-                       struct channel *chan = findChannel(channel);
+                       Channel *chan = findChannel(channel);
                        if (!chan)
                                return err_nosuchchannel(client, args[0]), sendbuf(client), 0;
                        channel_part(client, chan, args[1] ? args[1] : "", NULL);
@@ -644,7 +644,7 @@ saslcleanup:
                        return err_notregistered(client), sendbuf(client), 0;
                if (!args[0])
                        return err_needmoreparams(client, command), sendbuf(client), 0;
-               struct channel *chan = findChannel(args[0]);
+               Channel *chan = findChannel(args[0]);
                if (!chan)
                        return err_nosuchchannel(client, args[0]), sendbuf(client), 0;
                if (!args[1]) {
@@ -667,7 +667,7 @@ saslcleanup:
                }
                if (!args[1])
                        return err_needmoreparams(client, command), sendbuf(client), 0;
-               struct channel *chan = findChannel(args[1]);
+               Channel *chan = findChannel(args[1]);
                if (!chan)
                        return err_nosuchchannel(client, args[1]), sendbuf(client), 0;
                if (chan->dmode & DMODE_INVITEONLY) {
@@ -677,7 +677,7 @@ saslcleanup:
                        if (!chan->members.has(client))
                                return err_notonchannel(client, chan), sendbuf(client), 0;
                }
-               struct client_data *cl = findClient(args[0]);
+               Client *cl = findClient(args[0]);
                if (!cl)
                        return err_nosuchnick(client, args[0]), sendbuf(client), 0;
                if (chan->members.has(cl))
@@ -694,7 +694,7 @@ saslcleanup:
                        return err_notregistered(client), sendbuf(client), 0;
                if (argc < 2)
                        return err_needmoreparams(client, command), sendbuf(client), 0;
-               struct channel *chan = findChannel(args[0]);
+               Channel *chan = findChannel(args[0]);
                if (!chan)
                        return err_nosuchchannel(client, args[0]), sendbuf(client), 0;
                if (!chan->o.has(client))
@@ -706,7 +706,7 @@ saslcleanup:
                        char *nick = p;
                        if ((p = strchr(nick, ',')))
                                *p++ = '\0';
-                       struct client_data *cl = findClient(nick);
+                       Client *cl = findClient(nick);
                        if (!cl)
                                err_nosuchnick(client, nick), sendbuf(client);
                        else
@@ -731,7 +731,7 @@ saslcleanup:
                if (is_modmsg)
                        is_modmsg += !!strchr("@+", args[0][1]);
                if (strchr("#&", args[0][is_modmsg])) {
-                       struct channel *chan = findChannel(args[0]+is_modmsg);
+                       Channel *chan = findChannel(args[0]+is_modmsg);
                        if (!chan)
                                return err_nosuchchannel(client, args[0]), sendbuf(client), 0;
                        if (match_list(client, chan->listq))
@@ -766,7 +766,7 @@ saslcleanup:
                                sendbuf_list_sans_self(client, chan->o, 0);
                        }
                } else {
-                       struct client_data *cl = findClient(args[0]);
+                       Client *cl = findClient(args[0]);
 #ifdef HAVE_LUA
                        if (!cl)
                                return err_nosuchnick(client, args[0]), sendbuf(client), 0;
@@ -872,14 +872,14 @@ saslcleanup:
                char *nick = args[0];
                if (argc == 1) { // get mode
                        if (*nick != '#' && *nick != '&') {
-                               struct client_data *cl = findClient(nick);
+                               Client *cl = findClient(nick);
                                if (!cl)
                                        return err_nosuchnick(client, nick), sendbuf(client), 0;
                                if (client != cl)
                                        return err_usersdontmatch(client, "Can't view mode for other users"), sendbuf(client), 0;
                                rpl_umodeis(client), sendbuf(client);
                        } else {
-                               struct channel *chan = findChannel(nick);
+                               Channel *chan = findChannel(nick);
                                if (!chan)
                                        return err_nosuchchannel(client, nick), sendbuf(client), 0;
                                rpl_channelmodeis(client, chan), sendbuf(client);
@@ -887,7 +887,7 @@ saslcleanup:
                        }
                } else { // set mode
                        if (*nick != '#' && *nick != '&') {
-                               struct client_data *cl = findClient(nick);
+                               Client *cl = findClient(nick);
                                if (!cl)
                                        return err_nosuchnick(client, nick), sendbuf(client), 0;
                                if (client != cl)
@@ -931,7 +931,7 @@ saslcleanup:
                                        p++;
                                }
                        } else {
-                               struct channel *chan = findChannel(nick);
+                               Channel *chan = findChannel(nick);
                                if (!chan)
                                        return err_nosuchchannel(client, nick), sendbuf(client), 0;
                                if (!chan->o.has(client))
@@ -1000,7 +1000,7 @@ saslcleanup:
                        char *channel = p;
                        if ((p = strchr(channel, ',')))
                                *p++ = '\0';
-                       struct channel *chan = findChannel(channel);
+                       Channel *chan = findChannel(channel);
                        if (chan && (!(chan->dmode & DMODE_SECRET) || chan->members.has(client))) {
                                channel_sendnames(client, chan);
                        } else {
@@ -1013,11 +1013,11 @@ saslcleanup:
                        return err_notregistered(client), sendbuf(client), 0;
                if (argc == 0)
                        return err_needmoreparams(client, command), sendbuf(client), 0;
-               struct client_data *cls[5], **p = cls;
+               Client *cls[5], **p = cls;
                for (int i = 0; i < 5; i++) {
                        if (!args[i])
                                break;
-                       struct client_data *cl = findClient(args[i]);
+                       Client *cl = findClient(args[i]);
                        if (cl)
                                *p++ = cl;
                }
@@ -1030,7 +1030,7 @@ saslcleanup:
                if (argc == 0)
                        return err_needmoreparams(client, command), sendbuf(client), 0;
                if (strchr("#&", args[0][0])) {
-                       struct channel *chan = findChannel(args[0]);
+                       Channel *chan = findChannel(args[0]);
                        // TODO: handle chanmode +s, umode +i
                        if (chan) {
                                for (auto cl : chan->members)
@@ -1038,7 +1038,7 @@ saslcleanup:
                        }
                } else if (!strchr(args[0], '*')) {
                        // TODO: this probably needs better +i mode handling
-                       struct client_data *cl = findClient(args[0]);
+                       Client *cl = findClient(args[0]);
                        if (cl)
                                (args[1] ? rpl_whospcrpl(client, cl, 0, args[1]) : rpl_whoreply(client, cl, 0)), sendbuf(client);
                } else {
@@ -1065,7 +1065,7 @@ saslcleanup:
                if (argc == 0)
                        return err_needmoreparams(client, command), sendbuf(client), 0;
                char *nick = args[1] ? args[1] : args[0];
-               struct client_data *cl = findClient(nick);
+               Client *cl = findClient(nick);
                if (cl) {
 #ifdef HAVE_LIBTLS
                        if (client == cl || client->umode & UMODE_OPER)
@@ -1143,7 +1143,7 @@ saslcleanup:
                                        *p++ = '\0';
                                if (client->monitor.add(nick))
                                        monitor_count++;
-                               struct client_data *cl = client_map.get(nick);
+                               Client *cl = client_map.get(nick);
                                if (cl)
                                        rpl_mononline(client, cl), sendbuf(client);
                                else
@@ -1176,7 +1176,7 @@ saslcleanup:
                        break;
                case 'S':
                        for (auto key : client->monitor) {
-                               struct client_data *cl = client_map.get(key);
+                               Client *cl = client_map.get(key);
                                if (cl)
                                        rpl_mononline(client, cl), sendbuf(client);
                                else
@@ -1211,7 +1211,7 @@ unknown:
        return 0;
 }
 
-void newUser(struct client_data *client) {
+void newUser(Client *client) {
        if (client->regstate != REG_INIT || !client->nick_reg || !client->username || client->passwait || client->webircwait || client->saslusername)
                return;
        if (client->saslbuf) {
@@ -1258,7 +1258,7 @@ void newUser(struct client_data *client) {
        for (auto key : autojoin)
                channel_join(client, key, NULL);
 }
-void sendLUSERS(struct client_data *client)
+void sendLUSERS(Client *client)
 {
        int total = 0;
        int registered = 0;
@@ -1272,7 +1272,7 @@ void sendLUSERS(struct client_data *client)
                if (cl->umode & UMODE_OPER)
                        ops++;
        }
-       for (struct client_data *cl = clients; cl; cl = cl->next)
+       for (Client *cl = clients; cl; cl = cl->next)
                total++;
 
        rpl_luserclient(client, registered, invisible, 1), sendbuf(client);
@@ -1284,7 +1284,7 @@ void sendLUSERS(struct client_data *client)
        rpl_globalusers(client, registered, 69), sendbuf(client);
 }
 
-void sendMOTD(struct client_data *client) {
+void sendMOTD(Client *client) {
        char line[512];
        FILE *f = fopen(getdatafile("motd.txt"), "re");
        if (f) {
@@ -1302,7 +1302,7 @@ void sendMOTD(struct client_data *client) {
        }
 }
 
-static void updateNuh(struct client_data *client) {
+static void updateNuh(Client *client) {
        const char *n = client->nick ? client->nick : "*";
        const char *u = client->username ? client->username : "*";
        const char *h = client->hostname;
@@ -1313,7 +1313,7 @@ static void updateNuh(struct client_data *client) {
        sprintf(client->nuh, "%s!%s@%s", n, u, h);
        stringlower(client->nuh);
 }
-void setNick(struct client_data *client, char* nickname) {
+void setNick(Client *client, char* nickname) {
        // TODO: perform basic sanitization
 
        size_t nicklen = strlen(nickname);
@@ -1333,7 +1333,7 @@ void setNick(struct client_data *client, char* nickname) {
        stringlower(key);
 
        // TODO: make the cia nickname a define
-       if (struct client_data *other = client_map.get(key); other || !strcmp(key, "cia")) {
+       if (Client *other = client_map.get(key); other || !strcmp(key, "cia")) {
                if (client != other)
                        err_nicknameinuse(client, nickname), sendbuf(client);
                return;
@@ -1377,7 +1377,7 @@ void setNick(struct client_data *client, char* nickname) {
  * NULL means no change. additionally username can be client->username+1
  * this has to work during registration, so there are no assumptions about nick/username already existing
  */
-void client_chghost(struct client_data *client, const char *newusername, const char *newhostname)
+void client_chghost(Client *client, const char *newusername, const char *newhostname)
 {
        if (client->username && newusername && !strcmp(client->username, newusername))
                newusername = 0;
@@ -1463,7 +1463,7 @@ void client_chghost(struct client_data *client, const char *newusername, const c
        if (is_registered(client) && wasloggedin != willbeloggedin)
                copy_strf(&databuf, ":cia!cia@cia.gov MODE %s %cr\r\n", client->nick, willbeloggedin ? '+' : '-'), sendbuf(client);
 }
-void channel_sendtopic(struct client_data *client, struct channel *chan, int joining)
+void channel_sendtopic(Client *client, Channel *chan, int joining)
 {
        if (chan->topic) {
                rpl_topic(client, chan), sendbuf(client);
@@ -1472,7 +1472,7 @@ void channel_sendtopic(struct client_data *client, struct channel *chan, int joi
                rpl_notopic(client, chan), sendbuf(client);
        }
 }
-void channel_sendnames(struct client_data *client, struct channel *chan)
+void channel_sendnames(Client *client, Channel *chan)
 {
        databuf.clear();
        for (auto cl : chan->members)
@@ -1486,7 +1486,7 @@ void channel_sendnames(struct client_data *client, struct channel *chan)
        rpl_endofnames(client, chan->name);
        sendbuf(client);
 }
-void channel_join(struct client_data *client, const char *channel, const char *chankey)
+void channel_join(Client *client, const char *channel, const char *chankey)
 {
        // TODO: check channel limit?
        if (channel[0] != '#' && channel[0] != '&')
@@ -1499,7 +1499,7 @@ void channel_join(struct client_data *client, const char *channel, const char *c
        char key[MAX_CHANLEN];
        memcpy(key, channel, chanlen+1);
        stringlower(key);
-       struct channel *chan = channel_map.get(key);
+       Channel *chan = channel_map.get(key);
        int newchan = !chan;
        if (!chan) {
                chan = channel_new(channel, key, get_time());
@@ -1551,12 +1551,12 @@ void channel_join(struct client_data *client, const char *channel, const char *c
        // send names
        channel_sendnames(client, chan);
 }
-struct channel *channel_new(const char *channel, const char *key, time_t creation)
+Channel *channel_new(const char *channel, const char *key, time_t creation)
 {
-       struct channel *chan = (struct channel *)malloc(sizeof(struct channel));
+       Channel *chan = (Channel *)malloc(sizeof(Channel));
        if (!chan)
                abortf("malloc fail (channel)\n");
-       memset(chan, 0, sizeof(struct channel));
+       memset(chan, 0, sizeof(Channel));
        chan->creation = creation;
        chan->member_limit = -1;
        chan->dmode = DMODE_NOEXTERNAL | DMODE_TOPICPROT | DMODE_PERSIST;
@@ -1568,7 +1568,7 @@ struct channel *channel_new(const char *channel, const char *key, time_t creatio
                abortf("strdup fail (name)\n");
        return chan;
 }
-void channel_part(struct client_data *client, struct channel *chan, const char *reason, struct client_data *kicker)
+void channel_part(Client *client, Channel *chan, const char *reason, Client *kicker)
 {
        if (!chan->members.has(client))
                return;
@@ -1587,7 +1587,7 @@ void channel_part(struct client_data *client, struct channel *chan, const char *
        if (!chan->member_count && !(chan->dmode & DMODE_PERSIST))
                channel_kill(chan);
 }
-void channel_kill(struct channel *chan)
+void channel_kill(Channel *chan)
 {
        channel_map.remove(chan);
        for (auto cl : chan->invitees)
@@ -1609,7 +1609,7 @@ void channel_kill(struct channel *chan)
        free(chan->chankey);
        free(chan);
 }
-void channel_mode(struct client_data *client, struct channel *chan, char *args[]) {
+void channel_mode(Client *client, Channel *chan, char *args[]) {
        const char *n = client ? client->nick : "cia";
        const char *u = client ? client->username : "cia";
        const char *h = client ? client->hostname : "cia.gov";
@@ -1746,7 +1746,7 @@ void channel_mode(struct client_data *client, struct channel *chan, char *args[]
                                break;
                        const char *nick = *args++;
                        char which[2] = {*p, 0};
-                       struct client_data *cl = findClient(nick);
+                       Client *cl = findClient(nick);
                        if (!cl) {
                                if (client)
                                        err_nosuchnick(client, nick), sendbuf(client);
@@ -1775,7 +1775,7 @@ void channel_mode(struct client_data *client, struct channel *chan, char *args[]
                p++;
        }
 }
-void channel_topic(struct client_data *src, struct channel *chan, const char *topic, const char *who, time_t when)
+void channel_topic(Client *src, Channel *chan, const char *topic, const char *who, time_t when)
 {
        free(chan->topic);
        free(chan->topic_who);
@@ -1800,7 +1800,7 @@ void channel_topic(struct client_data *src, struct channel *chan, const char *to
        chanlog_time(chan->topic_when);
        sendbuf_chan(chan);
 }
-struct client_data *findClient(const char *nickname)
+Client *findClient(const char *nickname)
 {
        char key[MAX_NICKLEN];
        int len = strlen(nickname);
@@ -1810,7 +1810,7 @@ struct client_data *findClient(const char *nickname)
        stringlower(key);
        return client_map.get(key);
 }
-struct channel *findChannel(const char *channel)
+Channel *findChannel(const char *channel)
 {
        size_t chanlen = strlen(channel);
        if (chanlen >= MAX_CHANLEN)
index 065ba0e..a51bc5f 100644 (file)
@@ -7,24 +7,24 @@
 #include "util.hpp"
 #define is_registered(cl) ((cl)->regstate == REG_REGISTERED)
 void sendbuf_monitor(const char *nick, int cookie, int positive, int negative);
-const char *format_umodes(struct client_data *cl);
-int irc_parse_line(struct client_data *client, char *p, char *end);
-int irc_process_line(struct client_data *client, char *source, char *command, int argc, char *args[]);
-void newUser(struct client_data *client);
-void sendLUSERS(struct client_data *client);
-void sendMOTD(struct client_data *client);
-void setNick(struct client_data *client, char* nickname);
-void client_chghost(struct client_data *client, const char *newusername, const char *newhostname);
-struct client_data *findClient(const char *nickname);
-struct channel *findChannel(const char *channel);
-void channel_sendtopic(struct client_data *client, struct channel *chan, int joining);
-void channel_sendnames(struct client_data *client, struct channel *chan);
-void channel_join(struct client_data *client, const char *channel, const char *chankey);
-struct channel *channel_new(const char *channel, const char *key, time_t creation);
-void channel_part(struct client_data *client, struct channel *chan, const char *reason, struct client_data *kicker);
-void channel_kill(struct channel *chan);
-void channel_mode(struct client_data *client, struct channel *chan, char *args[]);
-void channel_topic(struct client_data *src, struct channel *chan, const char *topic, const char *who, time_t when);
+const char *format_umodes(Client *cl);
+int irc_parse_line(Client *client, char *p, char *end);
+int irc_process_line(Client *client, char *source, char *command, int argc, char *args[]);
+void newUser(Client *client);
+void sendLUSERS(Client *client);
+void sendMOTD(Client *client);
+void setNick(Client *client, char* nickname);
+void client_chghost(Client *client, const char *newusername, const char *newhostname);
+Client *findClient(const char *nickname);
+Channel *findChannel(const char *channel);
+void channel_sendtopic(Client *client, Channel *chan, int joining);
+void channel_sendnames(Client *client, Channel *chan);
+void channel_join(Client *client, const char *channel, const char *chankey);
+Channel *channel_new(const char *channel, const char *key, time_t creation);
+void channel_part(Client *client, Channel *chan, const char *reason, Client *kicker);
+void channel_kill(Channel *chan);
+void channel_mode(Client *client, Channel *chan, char *args[]);
+void channel_topic(Client *src, Channel *chan, const char *topic, const char *who, time_t when);
 extern std::vector<char> databuf;
 extern FILE *fchanlog;
 extern const char *hostname;
index 98fc9b1..7e945e7 100644 (file)
@@ -2,7 +2,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 #include "common.hpp"
 #include "ircfmt.hpp"
-static const char *format_prefixes(struct client_data *client, struct client_data *cl, struct channel *chan) {
+static const char *format_prefixes(Client *client, Client *cl, Channel *chan) {
        if (!chan) return "";
        int o = is_chanop(chan, cl);
        int v = is_chanvoice(chan, cl);
@@ -16,7 +16,7 @@ static const char *format_prefixes(struct client_data *client, struct client_dat
                return "";
 }
 
-void msg_away(struct client_data *src)
+void msg_away(Client *src)
 {
        if (src->away)
                copy_strf(&databuf, ":%s!%s@%s AWAY :%s\r\n",
@@ -25,7 +25,7 @@ void msg_away(struct client_data *src)
                copy_strf(&databuf, ":%s!%s@%s AWAY\r\n",
                                src->nick, src->username, src->hostname);
 }
-void msg_nick(struct client_data *src, const char *newnick)
+void msg_nick(Client *src, const char *newnick)
 {
        copy_strf(&databuf, ":%s!%s@%s NICK %s\r\n",
                        src->nick, src->username, src->hostname,
@@ -41,7 +41,7 @@ void msg_pong(const char *token)
 {
        copy_strf(&databuf, ":%s PONG %s :%s\r\n", hostname, hostname, token);
 }
-void msg_quit(struct client_data *src, const char *prefix, const char *reason)
+void msg_quit(Client *src, const char *prefix, const char *reason)
 {
        copy_strf(&databuf, ":%s!%s@%s QUIT :%s%s\r\n",
                        src->nick, src->username, src->hostname, prefix, reason);
@@ -50,18 +50,18 @@ void msg_error(const char *reason)
 {
        copy_strf(&databuf, ":%s ERROR :%s\r\n", hostname, reason);
 }
-void msg_join(struct client_data *src, struct channel *chan)
+void msg_join(Client *src, Channel *chan)
 {
        copy_strf(&databuf, ":%s!%s@%s JOIN %s\r\n",
                        src->nick, src->username, src->hostname, chan->name);
 }
-void msg_join_extended(struct client_data *src, struct channel *chan)
+void msg_join_extended(Client *src, Channel *chan)
 {
        copy_strf(&databuf, ":%s!%s@%s JOIN %s %s :%s\r\n",
                        src->nick, src->username, src->hostname, chan->name,
                        src->umode & UMODE_REGISTERED ? src->username : "*", src->realname);
 }
-void msg_part(struct client_data *src, struct channel *chan, const char *reason)
+void msg_part(Client *src, Channel *chan, const char *reason)
 {
        if (reason)
                copy_strf(&databuf, ":%s!%s@%s PART %s :%s\r\n",
@@ -70,18 +70,18 @@ void msg_part(struct client_data *src, struct channel *chan, const char *reason)
                copy_strf(&databuf, ":%s!%s@%s PART %s\r\n",
                                src->nick, src->username, src->hostname, chan->name);
 }
-void msg_topic(struct client_data *src, struct channel *chan)
+void msg_topic(Client *src, Channel *chan)
 {
        copy_strf(&databuf, ":%s!%s@%s TOPIC %s :%s\r\n",
                        src->nick, src->username, src->hostname,
                        chan->name, chan->topic ? chan->topic : "");
 }
-void msg_invite(struct client_data *src, struct client_data *dst, struct channel *chan)
+void msg_invite(Client *src, Client *dst, Channel *chan)
 {
        copy_strf(&databuf, ":%s!%s@%s INVITE %s %s\r\n",
                        src->nick, src->username, src->hostname, dst->nick, chan->name);
 }
-void msg_kick(struct client_data *src, struct client_data *who, struct channel *chan, const char *reason)
+void msg_kick(Client *src, Client *who, Channel *chan, const char *reason)
 {
        if (reason)
                copy_strf(&databuf, ":%s!%s@%s KICK %s %s :%s\r\n",
@@ -90,7 +90,7 @@ void msg_kick(struct client_data *src, struct client_data *who, struct channel *
                copy_strf(&databuf, ":%s!%s@%s KICK %s %s\r\n",
                                src->nick, src->username, src->hostname, chan->name, who->nick);
 }
-void msg_privmsg(struct client_data *src, const char *dst, const char *msg)
+void msg_privmsg(Client *src, const char *dst, const char *msg)
 {
        copy_strf(&databuf, ":%s!%s@%s PRIVMSG %s :%s\r\n",
                        src->nick, src->username, src->hostname, dst, msg);
@@ -100,7 +100,7 @@ void msg_privmsg_server(const char *src, const char *dst, const char *msg)
        copy_strf(&databuf, ":%s PRIVMSG %s :%s\r\n",
                        src, dst, msg);
 }
-void msg_notice(struct client_data *src, const char *dst, const char *msg)
+void msg_notice(Client *src, const char *dst, const char *msg)
 {
        copy_strf(&databuf, ":%s!%s@%s NOTICE %s :%s\r\n",
                        src->nick, src->username, src->hostname, dst, msg);
@@ -110,141 +110,141 @@ void msg_notice_server(const char *src, const char *dst, const char *msg)
        copy_strf(&databuf, ":%s NOTICE %s :%s\r\n",
                        src, dst, msg);
 }
-void msg_kill(struct client_data *src, struct client_data *dst, const char *reason)
+void msg_kill(Client *src, Client *dst, const char *reason)
 {
        copy_strf(&databuf, ":%s!%s@%s KILL %s :%s\r\n",
                        src->nick, src->username, src->hostname, dst->nick, reason);
 }
-void msg_wallops(struct client_data *src, const char *msg)
+void msg_wallops(Client *src, const char *msg)
 {
        copy_strf(&databuf, ":%s!%s@%s WALLOPS :%s\r\n",
                        src->nick, src->username, src->hostname, msg);
 }
-void msg_chghost(struct client_data *src, const char *newusername, const char *newhostname)
+void msg_chghost(Client *src, const char *newusername, const char *newhostname)
 {
        copy_strf(&databuf, ":%s!%s@%s CHGHOST %s %s\r\n",
                        src->nick, src->username, src->hostname, newusername, newhostname);
 }
-void msg_setname(struct client_data *src)
+void msg_setname(Client *src)
 {
        copy_strf(&databuf, ":%s!%s@%s SETNAME :%s\r\n",
                        src->nick, src->username, src->hostname, src->realname);
 }
-void msg_account(struct client_data *src)
+void msg_account(Client *src)
 {
        copy_strf(&databuf, ":%s!%s@%s ACCOUNT %s\r\n",
                        src->nick, src->username, src->hostname, src->username[0] != '~' ? src->username : "*");
 }
-void rpl_welcome(struct client_data *client) // 001
+void rpl_welcome(Client *client) // 001
 {
        copy_strf(&databuf, ":%s 001 %s :Welcome to the Patchy Network, %s\r\n", hostname, client->nick, client->nick);
 }
-void rpl_yourhost(struct client_data *client) // 002
+void rpl_yourhost(Client *client) // 002
 {
        copy_strf(&databuf, ":%s 002 %s :Your host is " PACKAGE_NAME ", running version " PACKAGE_VERSION "\r\n", hostname, client->nick);
 }
-void rpl_created(struct client_data *client) // 003
+void rpl_created(Client *client) // 003
 {
        copy_strf(&databuf, ":%s 003 %s :This server was created when I had cybersex with your mother.\r\n", hostname, client->nick);
 }
-void rpl_myinfo(struct client_data *client) // 004
+void rpl_myinfo(Client *client) // 004
 {
        copy_strf(&databuf, ":%s 004 %s " PACKAGE_STRING " iworZ beIqwklPimnstov\r\n", hostname, client->nick);
 }
-void rpl_isupport(struct client_data *client) // 005
+void rpl_isupport(Client *client) // 005
 {
        copy_strf(&databuf, ":%s 005 %s NETWORK=PatchyIRC CASEMAPPING=ascii NICKLEN=%u CHANNELLEN=%u EXCEPTS=e INVEX=I MAXTARGETS=1 CHANMODES=beIqw,k,l,Pimnst CHANTYPES=#& PREFIX=(ov)@+ STATUSMSG=@+ BOT=B WHOX MONITOR=%u :are supported by this server\r\n", hostname, client->nick, MAX_NICKLEN-1, MAX_CHANLEN-1, MONITOR_LIMIT);
 
 }
 #if 0
-void rpl_bounce(struct client_data *client, const char *host, const char *port, const char *info) // 010
+void rpl_bounce(Client *client, const char *host, const char *port, const char *info) // 010
 {
        copy_strf(&databuf, ":%s 010 %s %s %s :%s\r\n",
                        hostname, client->nick, host, port, info);
 }
 #endif
-void rpl_umodeis(struct client_data *client) // 221
+void rpl_umodeis(Client *client) // 221
 {
        copy_strf(&databuf, ":%s 221 %s %s\r\n", hostname, client->nick, format_umodes(client));
 }
-void rpl_luserclient(struct client_data *client, int users, int invisible, int servers) // 251
+void rpl_luserclient(Client *client, int users, int invisible, int servers) // 251
 {
        copy_strf(&databuf, ":%s 251 %s :There are %u users and %u invisible on %u servers\r\n",
                        hostname, client->nick, users, invisible, servers);
 }
-void rpl_luserop(struct client_data *client, int ops) // 252
+void rpl_luserop(Client *client, int ops) // 252
 {
        copy_strf(&databuf, ":%s 252 %s %u :operator(s) online\r\n",
                        hostname, client->nick, ops);
 }
-void rpl_luserunknown(struct client_data *client, int unk) // 253
+void rpl_luserunknown(Client *client, int unk) // 253
 {
        copy_strf(&databuf, ":%s 253 %s %u :unknown connection(s)\r\n",
                        hostname, client->nick, unk);
 }
-void rpl_luserchannels(struct client_data *client, int channels) // 254
+void rpl_luserchannels(Client *client, int channels) // 254
 {
        copy_strf(&databuf, ":%s 254 %s %u :channels formed\r\n",
                        hostname, client->nick, channels);
 }
-void rpl_luserme(struct client_data *client, int clients, int servers) // 255
+void rpl_luserme(Client *client, int clients, int servers) // 255
 {
        copy_strf(&databuf, ":%s 255 %s :I have %u clients and %u servers\r\n",
                        hostname, client->nick, clients, servers);
 }
-void rpl_adminme(struct client_data *client) // 256
+void rpl_adminme(Client *client) // 256
 {
        copy_strf(&databuf, ":%s 256 %s %s :Administrative info\r\n",
                        hostname, client->nick, hostname);
 }
-void rpl_adminloc1(struct client_data *client, const char *loc) // 257
+void rpl_adminloc1(Client *client, const char *loc) // 257
 {
        copy_strf(&databuf, ":%s 257 %s :%s\r\n",
                        hostname, client->nick, loc);
 }
-void rpl_adminloc2(struct client_data *client, const char *loc) // 258
+void rpl_adminloc2(Client *client, const char *loc) // 258
 {
        copy_strf(&databuf, ":%s 258 %s :%s\r\n",
                        hostname, client->nick, loc);
 }
-void rpl_adminemail(struct client_data *client, const char *email) // 259
+void rpl_adminemail(Client *client, const char *email) // 259
 {
        copy_strf(&databuf, ":%s 259 %s :%s\r\n",
                        hostname, client->nick, email);
 }
 #if 0
-void rpl_tryagain(struct client_data *client, const char *command) // 263
+void rpl_tryagain(Client *client, const char *command) // 263
 {
        copy_strf(&databuf, ":%s 263 %s %s :Please wait a while and try again\r\n",
                        hostname, client->nick, command);
 }
 #endif
-void rpl_localusers(struct client_data *client, int current, int max) // 265
+void rpl_localusers(Client *client, int current, int max) // 265
 {
        copy_strf(&databuf, ":%s 265 %s :Current local users %u, max %u\r\n",
                        hostname, client->nick, current, max, current, max);
 }
-void rpl_globalusers(struct client_data *client, int current, int max) // 266
+void rpl_globalusers(Client *client, int current, int max) // 266
 {
        copy_strf(&databuf, ":%s 266 %s %u %u :Current global users %u, max %u\r\n",
                        hostname, client->nick, current, max, current, max);
 }
-void rpl_whoiscertfp(struct client_data *client, struct client_data *cl, const char *certfp) // 276
+void rpl_whoiscertfp(Client *client, Client *cl, const char *certfp) // 276
 {
        copy_strf(&databuf, ":%s 276 %s %s :has client certificate fingerprint %s\r\n",
                        hostname, client->nick, cl->nick, certfp);
 }
 #if 0
-void rpl_none(struct client_data *client, const char *line) // 300
+void rpl_none(Client *client, const char *line) // 300
 {
        copy_strf(&databuf, ":%s 300 %s %s\r\n", hostname, client->nick, line);
 }
 #endif
-void rpl_away(struct client_data *client, struct client_data *cl) // 301
+void rpl_away(Client *client, Client *cl) // 301
 {
        copy_strf(&databuf, ":%s 301 %s %s :%s\r\n", hostname, client->nick, cl->nick, cl->away);
 }
-void rpl_userhost(struct client_data *client, struct client_data **cls, int count) // 302
+void rpl_userhost(Client *client, Client **cls, int count) // 302
 {
        copy_strf(&databuf, ":%s 302 %s", hostname, client->nick);
        for (int i = 0; i < count; i++) {
@@ -257,15 +257,15 @@ void rpl_userhost(struct client_data *client, struct client_data **cls, int coun
        }
        append_str(&databuf, "\r\n");
 }
-void rpl_unaway(struct client_data *client) // 305
+void rpl_unaway(Client *client) // 305
 {
        copy_strf(&databuf, ":%s 305 %s :You are no longer marked as being away\r\n", hostname, client->nick);
 }
-void rpl_nowaway(struct client_data *client) // 306
+void rpl_nowaway(Client *client) // 306
 {
        copy_strf(&databuf, ":%s 306 %s :You have been marked as being away\r\n", hostname, client->nick);
 }
-void rpl_whoreply(struct client_data *client, struct client_data *cl, struct channel *chan) // 352
+void rpl_whoreply(Client *client, Client *cl, Channel *chan) // 352
 {
        copy_strf(&databuf, ":%s 352 %s %s %s %s %s %s %s%s%s%s :1 %s\r\n",
                        hostname, client->nick, chan ? chan->name : "*", cl->username, cl->hostname, hostname, cl->nick,
@@ -273,7 +273,7 @@ void rpl_whoreply(struct client_data *client, struct client_data *cl, struct cha
                        cl->umode&UMODE_BOT ? "B" : "",
                        cl->realname);
 }
-void rpl_whospcrpl(struct client_data *client, struct client_data *cl, struct channel *chan, const char *fmt) // 354
+void rpl_whospcrpl(Client *client, Client *cl, Channel *chan, const char *fmt) // 354
 {
        int flags = 0;
        while (*fmt != '%')
@@ -331,59 +331,59 @@ void rpl_whospcrpl(struct client_data *client, struct client_data *cl, struct ch
                append_strf(&databuf, " :%s", cl->realname);
        append_strf(&databuf, "\r\n");
 }
-void rpl_endofwho(struct client_data *client, const char *query) // 315
+void rpl_endofwho(Client *client, const char *query) // 315
 {
        copy_strf(&databuf, ":%s 315 %s %s :End of WHO list\r\n", hostname, client->nick, query);
 }
-void rpl_whoisregnick(struct client_data *client, struct client_data *cl) // 307
+void rpl_whoisregnick(Client *client, Client *cl) // 307
 {
        copy_strf(&databuf, ":%s 307 %s %s :has identified for this nick\r\n", hostname, client->nick, cl->nick);
 }
-void rpl_whoisuser(struct client_data *client, struct client_data *cl) // 311
+void rpl_whoisuser(Client *client, Client *cl) // 311
 {
        copy_strf(&databuf, ":%s 311 %s %s %s %s * :%s\r\n", hostname, client->nick, cl->nick, cl->username, cl->hostname, cl->realname);
 }
-void rpl_whoisserver(struct client_data *client, struct client_data *cl) // 312
+void rpl_whoisserver(Client *client, Client *cl) // 312
 {
        copy_strf(&databuf, ":%s 312 %s %s %s :Patchy server\r\n", hostname, client->nick, cl->nick, hostname);
 }
-void rpl_whoisoperator(struct client_data *client, struct client_data *cl) // 313
+void rpl_whoisoperator(Client *client, Client *cl) // 313
 {
        copy_strf(&databuf, ":%s 313 %s %s :is an IRC operator\r\n", hostname, client->nick, cl->nick);
 }
 // 314 RPL_WHOWASUSER
-void rpl_whoisidle(struct client_data *client, struct client_data *cl) // 317
+void rpl_whoisidle(Client *client, Client *cl) // 317
 {
        // FIXME: 64-bit time_t support
        copy_strf(&databuf, ":%s 317 %s %s %u %u :seconds idle, signon time\r\n",
                        hostname, client->nick, cl->nick, (unsigned)(get_time()-cl->lastactivity), (unsigned)cl->signon);
 }
-void rpl_endofwhois(struct client_data *client, struct client_data *cl) // 318
+void rpl_endofwhois(Client *client, Client *cl) // 318
 {
        copy_strf(&databuf, ":%s 318 %s %s :End of /WHOIS list\r\n", hostname, client->nick, cl->nick);
 }
-void rpl_whoischannels(struct client_data *client, struct client_data *cl, struct channel *chan) // 319
+void rpl_whoischannels(Client *client, Client *cl, Channel *chan) // 319
 {
        copy_strf(&databuf, ":%s 319 %s %s :%s%s\r\n", hostname, client->nick, cl->nick, format_prefixes(client, cl, chan), chan->name);
 }
-void rpl_whoisspecial(struct client_data *client, struct client_data *cl, const char *prefix, const char *info) // 320
+void rpl_whoisspecial(Client *client, Client *cl, const char *prefix, const char *info) // 320
 {
        copy_strf(&databuf, ":%s 320 %s %s :%s%s\r\n", hostname, client->nick, cl->nick, prefix, info);
 }
-void rpl_liststart(struct client_data *client) // 321
+void rpl_liststart(Client *client) // 321
 {
        copy_strf(&databuf, ":%s 321 %s Channel :Users  Name\r\n", hostname, client->nick);
 }
-void rpl_list(struct client_data *client, struct channel *chan) // 322
+void rpl_list(Client *client, Channel *chan) // 322
 {
        copy_strf(&databuf, ":%s 322 %s %s %u :%s\r\n", hostname, client->nick,
                        chan->name, chan->member_count, chan->topic ? chan->topic : "");
 }
-void rpl_listend(struct client_data *client) // 323
+void rpl_listend(Client *client) // 323
 {
        copy_strf(&databuf, ":%s 323 %s :End of /LIST\r\n", hostname, client->nick);
 }
-void rpl_channelmodeis(struct client_data *client, struct channel *chan) // 324
+void rpl_channelmodeis(Client *client, Channel *chan) // 324
 {
        copy_strf(&databuf, ":%s 324 %s %s +", hostname, client->nick, chan->name);
        if (chan->dmode & DMODE_PERSIST) append_str(&databuf, "P");
@@ -398,73 +398,73 @@ void rpl_channelmodeis(struct client_data *client, struct channel *chan) // 324
        if (chan->chankey) append_strf(&databuf, " %s", chan->chankey);
        append_str(&databuf, "\r\n");
 }
-void rpl_creationtime(struct client_data *client, struct channel *chan) // 329
+void rpl_creationtime(Client *client, Channel *chan) // 329
 {
        // FIXME: 64-bit time_t support
        copy_strf(&databuf, ":%s 329 %s %s %u\r\n", hostname, client->nick, chan->name, (unsigned)chan->creation);
 }
-void rpl_whoisaccount(struct client_data *client, struct client_data *cl) // 330
+void rpl_whoisaccount(Client *client, Client *cl) // 330
 {
        copy_strf(&databuf, ":%s 330 %s %s %s :is logged in as\r\n", hostname, client->nick, cl->nick, cl->username);
 }
-void rpl_notopic(struct client_data *client, struct channel *chan) // 331
+void rpl_notopic(Client *client, Channel *chan) // 331
 {
        copy_strf(&databuf, ":%s 331 %s %s :No topic is set\r\n", hostname, client->nick,
                        chan->name);
 }
-void rpl_topic(struct client_data *client, struct channel *chan) // 332
+void rpl_topic(Client *client, Channel *chan) // 332
 {
        copy_strf(&databuf, ":%s 332 %s %s :%s\r\n", hostname, client->nick,
                        chan->name, chan->topic);
 }
-void rpl_topicwhotime(struct client_data *client, struct channel *chan) // 333
+void rpl_topicwhotime(Client *client, Channel *chan) // 333
 {
        // FIXME: 64-bit time_t support
        copy_strf(&databuf, ":%s 333 %s %s %s %u\r\n", hostname, client->nick,
                        chan->name, chan->topic_who, (unsigned)chan->topic_when);
 }
-void rpl_whoisbot(struct client_data *client, struct client_data *cl) // 335
+void rpl_whoisbot(Client *client, Client *cl) // 335
 {
        copy_strf(&databuf, ":%s 335 %s %s :is a bot\r\n", hostname, client->nick, cl->nick);
 }
-void rpl_invitelist(struct client_data *client, struct channel *chan) // 336
+void rpl_invitelist(Client *client, Channel *chan) // 336
 {
        copy_strf(&databuf, ":%s 336 %s %s\r\n", hostname, client->nick, chan->name);
 }
-void rpl_endofinvitelist(struct client_data *client) // 337
+void rpl_endofinvitelist(Client *client) // 337
 {
        copy_strf(&databuf, ":%s 337 %s :End of /INVITE list\r\n", hostname, client->nick);
 }
-void rpl_whoisactually(struct client_data *client, struct client_data *cl) // 338
+void rpl_whoisactually(Client *client, Client *cl) // 338
 {
        copy_strf(&databuf, ":%s 338 %s %s %s :Is actually using host\r\n", hostname, client->nick, cl->nick, cl->peername);
 }
-void rpl_inviting(struct client_data *client, struct client_data *cl, struct channel *chan) // 341
+void rpl_inviting(Client *client, Client *cl, Channel *chan) // 341
 {
        copy_strf(&databuf, ":%s 341 %s %s %s\r\n", hostname, client->nick, cl->nick, chan->name);
 }
-void rpl_invexlist(struct client_data *client, struct channel *chan, const char *mask) // 346
+void rpl_invexlist(Client *client, Channel *chan, const char *mask) // 346
 {
        copy_strf(&databuf, ":%s 346 %s %s %s\r\n", hostname, client->nick, chan->name, mask);
 }
-void rpl_endofinvexlist(struct client_data *client, struct channel *chan) // 347
+void rpl_endofinvexlist(Client *client, Channel *chan) // 347
 {
        copy_strf(&databuf, ":%s 347 %s %s :End of Channel Invite Exception List\r\n", hostname, client->nick, chan->name);
 }
-void rpl_exceptlist(struct client_data *client, struct channel *chan, const char *mask) // 348
+void rpl_exceptlist(Client *client, Channel *chan, const char *mask) // 348
 {
        copy_strf(&databuf, ":%s 348 %s %s %s\r\n", hostname, client->nick, chan->name, mask);
 }
-void rpl_endofexceptlist(struct client_data *client, struct channel *chan) // 349
+void rpl_endofexceptlist(Client *client, Channel *chan) // 349
 {
        copy_strf(&databuf, ":%s 349 %s %s :End of channel exception list\r\n", hostname, client->nick, chan->name);
 }
-void rpl_version(struct client_data *client, const char *ver, const char *comments) // 351
+void rpl_version(Client *client, const char *ver, const char *comments) // 351
 {
        copy_strf(&databuf, ":%s 351 %s %s %s :%s\r\n", hostname, client->nick,
                        ver, hostname, comments);
 }
-int rpl_namreply(struct client_data *client, struct channel *chan, struct client_data *cl) // 353
+int rpl_namreply(Client *client, Channel *chan, Client *cl) // 353
 {
        if (!cl) {
                if (databuf.size()) {
@@ -488,46 +488,46 @@ int rpl_namreply(struct client_data *client, struct channel *chan, struct client
        append_strf(&databuf, "%s%s", prefix, cl->nick);
        return 0;
 }
-void rpl_endofnames(struct client_data *client, const char *channel) // 366
+void rpl_endofnames(Client *client, const char *channel) // 366
 {
        copy_strf(&databuf, ":%s 366 %s %s :End of /NAMES list\r\n", hostname, client->nick, channel);
 }
 // 364 RPL_LINKS
 // 365 RPL_ENDOFLINKS
-void rpl_banlist(struct client_data *client, struct channel *chan, const char *mask) // 367
+void rpl_banlist(Client *client, Channel *chan, const char *mask) // 367
 {
        copy_strf(&databuf, ":%s 367 %s %s %s\r\n", hostname, client->nick, chan->name, mask);
 }
-void rpl_endofbanlist(struct client_data *client, struct channel *chan) // 368
+void rpl_endofbanlist(Client *client, Channel *chan) // 368
 {
        copy_strf(&databuf, ":%s 368 %s %s :End of channel ban list\r\n", hostname, client->nick, chan->name);
 }
 // 369 RPL_ENDOFWHOWAS
 // 371 RPL_INFO
 // 374 RPL_ENDOFINFO
-void rpl_motdstart(struct client_data *client) // 375
+void rpl_motdstart(Client *client) // 375
 {
        copy_strf(&databuf, ":%s 375 %s :- %s Message of the day - \r\n", hostname, client->nick, hostname);
 }
-void rpl_motd(struct client_data *client, const char *line) // 372
+void rpl_motd(Client *client, const char *line) // 372
 {
        copy_strf(&databuf, ":%s 372 %s :%s\r\n", hostname, client->nick, line);
 }
-void rpl_endofmotd(struct client_data *client) // 376
+void rpl_endofmotd(Client *client) // 376
 {
        copy_strf(&databuf, ":%s 376 %s :End of /MOTD command.\r\n", hostname, client->nick);
 }
 // 378 RPL_WHOISHOST
-void rpl_whoismodes(struct client_data *client, struct client_data *cl) // 379
+void rpl_whoismodes(Client *client, Client *cl) // 379
 {
        copy_strf(&databuf, ":%s 379 %s %s :is using modes %s\r\n", hostname, client->nick, cl->nick, format_umodes(cl));
 }
-void rpl_youreoper(struct client_data *client) // 381
+void rpl_youreoper(Client *client) // 381
 {
        copy_strf(&databuf, ":%s 381 %s :You are now an IRC operator\r\n", hostname, client->nick);
 }
 // 382 RPL_REHASHING
-void rpl_time(struct client_data *client, time_t ts) // 391
+void rpl_time(Client *client, time_t ts) // 391
 {
        // FIXME: 64-bit time_t support
        char buf[26];
@@ -535,153 +535,153 @@ void rpl_time(struct client_data *client, time_t ts) // 391
        buf[24] = '\0';
        copy_strf(&databuf, ":%s 391 %s %s :%s\r\n", hostname, client->nick, ts, buf);
 }
-void rpl_visiblehost(struct client_data *client) // 396
+void rpl_visiblehost(Client *client) // 396
 {
        copy_strf(&databuf, ":%s 396 %s %s@%s :is now you visible host\r\n", hostname, client->nick, client->username, client->hostname);
 }
 #if 0
-void err_unknownerror(struct client_data *client, const char *command, const char *msg) // 400
+void err_unknownerror(Client *client, const char *command, const char *msg) // 400
 {
        copy_strf(&databuf, ":%s 400 %s %s :%s\r\n", hostname, client->nick, command, msg);
 }
 #endif
-void err_nosuchnick(struct client_data *client, const char *nick) // 401
+void err_nosuchnick(Client *client, const char *nick) // 401
 {
        copy_strf(&databuf, ":%s 401 %s %s :No such nick/channel\r\n", hostname, client->nick, nick);
 }
-void err_nosuchserver(struct client_data *client, const char *server) // 402
+void err_nosuchserver(Client *client, const char *server) // 402
 {
        copy_strf(&databuf, ":%s 402 %s %s :No such server\r\n", hostname, client->nick, server);
 }
-void err_nosuchchannel(struct client_data *client, const char *channel) // 403
+void err_nosuchchannel(Client *client, const char *channel) // 403
 {
        copy_strf(&databuf, ":%s 403 %s %s :No such channel\r\n", hostname, client->nick, channel);
 }
-void err_cannotsendtochan(struct client_data *client, const char *channel) // 404
+void err_cannotsendtochan(Client *client, const char *channel) // 404
 {
        copy_strf(&databuf, ":%s 404 %s %s :Cannot send to channel\r\n", hostname, client->nick, channel);
 }
 #if 0
-void err_toomanychannels(struct client_data *client, const char *channel) // 405
+void err_toomanychannels(Client *client, const char *channel) // 405
 {
        copy_strf(&databuf, ":%s 405 %s %s :You have joined too many channels\r\n", hostname, client->nick, channel);
 }
-void err_wasnosuchnick(struct client_data *client) // 406
+void err_wasnosuchnick(Client *client) // 406
 {
        copy_strf(&databuf, ":%s 406 %s :There was no such nickname\r\n", hostname, client->nick);
 }
-void err_noorigin(struct client_data *client) // 409
+void err_noorigin(Client *client) // 409
 {
        copy_strf(&databuf, ":%s 409 %s :No origin specified\r\n", hostname, client->nick);
 }
-void err_inputtoolong(struct client_data *client) // 417
+void err_inputtoolong(Client *client) // 417
 {
        copy_strf(&databuf, ":%s 417 %s :Input line was too long\r\n", hostname, client->nick);
 }
 #endif
-void err_unknowncommand(struct client_data *client, const char *command) // 421
+void err_unknowncommand(Client *client, const char *command) // 421
 {
        copy_strf(&databuf, ":%s 421 %s %s :Unknown command\r\n", hostname, client->nick ? client->nick : "*", command);
 }
-void err_nomotd(struct client_data *client) // 422
+void err_nomotd(Client *client) // 422
 {
        copy_strf(&databuf, ":%s 422 %s :MOTD File is missing\r\n", hostname, client->nick);
 }
-void err_erroneusnickname(struct client_data *client, const char *nick) // 432
+void err_erroneusnickname(Client *client, const char *nick) // 432
 {
        copy_strf(&databuf, ":%s 432 %s %s :Erroneus nickname\r\n", hostname, client->nick, nick);
 }
-void err_nicknameinuse(struct client_data *client, const char *nick) // 433
+void err_nicknameinuse(Client *client, const char *nick) // 433
 {
        copy_strf(&databuf, ":%s 433 %s %s :Nickname is already in use\r\n", hostname, client->nick ? client->nick : "*", nick);
 }
-void err_usernotinchannel(struct client_data *client, const char *nick, struct channel *chan) // 441
+void err_usernotinchannel(Client *client, const char *nick, Channel *chan) // 441
 {
        copy_strf(&databuf, ":%s 441 %s %s %s :They aren't on that channel\r\n", hostname, client->nick, nick, chan->name);
 }
-void err_notonchannel(struct client_data *client, struct channel *chan) // 442
+void err_notonchannel(Client *client, Channel *chan) // 442
 {
        copy_strf(&databuf, ":%s 442 %s %s :You're not on that channel\r\n", hostname, client->nick, chan->name);
 }
-void err_useronchannel(struct client_data *client, const char *nick, struct channel *chan) // 443
+void err_useronchannel(Client *client, const char *nick, Channel *chan) // 443
 {
        copy_strf(&databuf, ":%s 443 %s %s %s :is already on channel\r\n", hostname, client->nick, nick, chan->name);
 }
-void err_notregistered(struct client_data *client) // 451
+void err_notregistered(Client *client) // 451
 {
        (void)client;
        copy_strf(&databuf, ":%s 451 * :You have not registered\r\n", hostname);
 }
-void err_needmoreparams(struct client_data *client, const char *command) // 461
+void err_needmoreparams(Client *client, const char *command) // 461
 {
        copy_strf(&databuf, ":%s 461 %s %s :Not enough parameters\r\n", hostname, client->nick ? client->nick : "*", command);
 }
-void err_alreadyregistered(struct client_data *client) // 462
+void err_alreadyregistered(Client *client) // 462
 {
        copy_strf(&databuf, ":%s 462 %s :You may not reregister\r\n", hostname, client->nick ? client->nick : "*");
 }
-void err_passwdmismatch(struct client_data *client) // 464
+void err_passwdmismatch(Client *client) // 464
 {
        copy_strf(&databuf, ":%s 464 %s :Password incorrect\r\n", hostname, client->nick ? client->nick : "*");
 }
 #if 0
-void err_yourebannedcreep(struct client_data *client) // 465
+void err_yourebannedcreep(Client *client) // 465
 {
        copy_strf(&databuf, ":%s 465 %s :You are banned from this server.\r\n", hostname, client->nick ? client->nick : "*");
 }
 #endif
-void err_channelisfull(struct client_data *client, struct channel *chan) // 471
+void err_channelisfull(Client *client, Channel *chan) // 471
 {
        copy_strf(&databuf, ":%s 471 %s %s :Cannot join channel (+l)\r\n", hostname, client->nick, chan->name);
 }
-void err_unknownmode(struct client_data *client, char mode) // 472
+void err_unknownmode(Client *client, char mode) // 472
 {
        char modes[2] = {mode, 0};
        copy_strf(&databuf, ":%s 472 %s %s :is unknown mode char to me\r\n", hostname, client->nick, modes);
 }
-void err_inviteonlychan(struct client_data *client, struct channel *chan) // 473
+void err_inviteonlychan(Client *client, Channel *chan) // 473
 {
        copy_strf(&databuf, ":%s 473 %s %s :Cannot join channel (+i)\r\n", hostname, client->nick, chan->name);
 }
-void err_bannedfromchan(struct client_data *client, struct channel *chan) // 474
+void err_bannedfromchan(Client *client, Channel *chan) // 474
 {
        copy_strf(&databuf, ":%s 474 %s %s :Cannot join channel (+b)\r\n", hostname, client->nick, chan->name);
 }
-void err_badchannelkey(struct client_data *client, struct channel *chan) // 475
+void err_badchannelkey(Client *client, Channel *chan) // 475
 {
        copy_strf(&databuf, ":%s 475 %s %s :Cannot join channel (+k)\r\n", hostname, client->nick, chan->name);
 }
-void err_badchanmask(struct client_data *client, const char *channel) // 476
+void err_badchanmask(Client *client, const char *channel) // 476
 {
        copy_strf(&databuf, ":%s 476 %s :Bad Channel Mask\r\n", hostname, client->nick, channel);
 }
-void err_noprivileges(struct client_data *client) // 481
+void err_noprivileges(Client *client) // 481
 {
        copy_strf(&databuf, ":%s 481 %s :Permission Denied- You're not an IRC operator\r\n", hostname, client->nick);
 }
-void err_chanoprivsneeded(struct client_data *client, struct channel *chan) // 481
+void err_chanoprivsneeded(Client *client, Channel *chan) // 481
 {
        copy_strf(&databuf, ":%s 482 %s %s :You're not channel operator\r\n", hostname, client->nick, chan->name);
 }
 // 483 ERR_CANTKILLSERVER
 // 491 ERR_NOOPERHOST
-void err_umodeunknownflag(struct client_data *client) // 501
+void err_umodeunknownflag(Client *client) // 501
 {
        copy_strf(&databuf, ":%s 501 %s :Unknown MODE flag\r\n", hostname, client->nick);
 }
-void err_usersdontmatch(struct client_data *client, const char *what) // 502
+void err_usersdontmatch(Client *client, const char *what) // 502
 {
        copy_strf(&databuf, ":%s 502 %s :%s\r\n", hostname, client->nick, what);
 }
-void err_helpnotfound(struct client_data *client) // 524
+void err_helpnotfound(Client *client) // 524
 {
        copy_strf(&databuf, ":%s 524 %s * :No help available on this topic\r\n", hostname, client->nick);
 }
-void err_invalidkey(struct client_data *client, struct channel *chan) // 525
+void err_invalidkey(Client *client, Channel *chan) // 525
 {
        copy_strf(&databuf, ":%s 525 %s %s :Key is not well-formed\r\n", hostname, client->nick, chan->name);
 }
-void err_cantsendtouser(struct client_data *client, struct client_data *cl) // 531
+void err_cantsendtouser(Client *client, Client *cl) // 531
 {
        copy_strf(&databuf, ":%s 531 %s %s :You are not permitted to send private messages to this user\r\n", hostname, client->nick, cl->nick);
 }
@@ -689,53 +689,53 @@ void err_cantsendtouser(struct client_data *client, struct client_data *cl) // 5
 // 671 RPL_WHOISSECURE
 // 691 ERR_STARTTLS
 // 696 ERR_INVALIDMODEPARAM
-void rpl_helpstart(struct client_data *client) // 704
+void rpl_helpstart(Client *client) // 704
 {
        copy_strf(&databuf, ":%s 704 %s * :** /HELP **\r\n", hostname, client->nick);
 }
-void rpl_helptxt(struct client_data *client, const char *line) // 705
+void rpl_helptxt(Client *client, const char *line) // 705
 {
        copy_strf(&databuf, ":%s 705 %s * :%s\r\n", hostname, client->nick, line);
 }
-void rpl_endofhelp(struct client_data *client) // 706
+void rpl_endofhelp(Client *client) // 706
 {
        copy_strf(&databuf, ":%s 706 %s * :End of /HELP\r\n", hostname, client->nick);
 }
 // 723 ERR_NOPRIVS
-void rpl_quietlist(struct client_data *client, struct channel *chan, const char *mask) // 728
+void rpl_quietlist(Client *client, Channel *chan, const char *mask) // 728
 {
        copy_strf(&databuf, ":%s 728 %s %s q %s\r\n", hostname, client->nick, chan->name, mask);
 }
-void rpl_endofquietlist(struct client_data *client, struct channel *chan) // 729
+void rpl_endofquietlist(Client *client, Channel *chan) // 729
 {
        copy_strf(&databuf, ":%s 729 %s %s q :End of channel quiet list\r\n", hostname, client->nick, chan->name);
 }
-void rpl_mononline(struct client_data *client, struct client_data *cl) // 730
+void rpl_mononline(Client *client, Client *cl) // 730
 {
        copy_strf(&databuf, ":%s 730 %s :%s!%s@%s\r\n", hostname, client ? client->nick : "*", cl->nick, cl->username, cl->hostname);
 }
-void rpl_monoffline(struct client_data *client, const char *nick) // 731
+void rpl_monoffline(Client *client, const char *nick) // 731
 {
        copy_strf(&databuf, ":%s 731 %s :%s\r\n", hostname, client ? client->nick : "*", nick);
 }
-void rpl_monlist(struct client_data *client, const char *nick) // 732
+void rpl_monlist(Client *client, const char *nick) // 732
 {
        copy_strf(&databuf, ":%s 732 %s :%s\r\n", hostname, client->nick, nick);
 }
-void rpl_endofmonlist(struct client_data *client) // 733
+void rpl_endofmonlist(Client *client) // 733
 {
        copy_strf(&databuf, ":%s 733 %s :End of MONITOR list\r\n", hostname, client->nick);
 }
-void rpl_monlistfull(struct client_data *client, int limit, const char *targets) // 734
+void rpl_monlistfull(Client *client, int limit, const char *targets) // 734
 {
        copy_strf(&databuf, ":%s 734 %s %d %s :Monitor list is full.\r\n", hostname, client->nick, limit, targets);
 }
-void rpl_loggedin(struct client_data *client) // 900
+void rpl_loggedin(Client *client) // 900
 {
        copy_strf(&databuf, ":%s 900 %s %s %s :You are now logged in as %s\r\n",
                        hostname, client->nick ? client->nick : "*", client->nuh, client->username, client->username);
 }
-void rpl_loggedout(struct client_data *client) // 901
+void rpl_loggedout(Client *client) // 901
 {
        copy_strf(&databuf, ":%s 901 %s %s :You are now logged out\r\n",
                        hostname, client->nick ? client->nick : "*", client->nuh);
@@ -765,12 +765,12 @@ void rpl_saslmechs(void) // 908
 {
        copy_strf(&databuf, ":%s 908 * PLAIN,EXTERNAL :are available SASL mechanisms\r\n", hostname);
 }
-void rpl_accesslist(struct client_data *client, struct channel *chan, char mode, const char *mask) // 910
+void rpl_accesslist(Client *client, Channel *chan, char mode, const char *mask) // 910
 {
        char modes[2] = {mode,0};
        copy_strf(&databuf, ":%s 910 %s %s %s:%s\r\n", hostname, client->nick, chan->name, modes, mask);
 }
-void rpl_endofaccesslist(struct client_data *client, struct channel *chan) // 911
+void rpl_endofaccesslist(Client *client, Channel *chan) // 911
 {
        copy_strf(&databuf, ":%s 911 %s %s :End of channel access list\r\n", hostname, client->nick, chan->name);
 }
index 7b9601d..1a9068a 100644 (file)
 #ifndef IRCFMT_H_
 #define IRCFMT_H_
 #include "irc.hpp"
-void msg_away(struct client_data *src);
-void msg_nick(struct client_data *src, const char *newnick);
+void msg_away(Client *src);
+void msg_nick(Client *src, const char *newnick);
 void msg_ping(const char *token);
 void msg_pong(const char *token);
-void msg_quit(struct client_data *src, const char *prefix, const char *reason);
+void msg_quit(Client *src, const char *prefix, const char *reason);
 void msg_error(const char *reason);
-void msg_join(struct client_data *src, struct channel *chan);
-void msg_join_extended(struct client_data *src, struct channel *chan);
-void msg_part(struct client_data *src, struct channel *chan, const char *reason);
-void msg_topic(struct client_data *src, struct channel *chan);
-void msg_invite(struct client_data *src, struct client_data *dst, struct channel *chan);
-void msg_kick(struct client_data *src, struct client_data *who, struct channel *chan, const char *reason);
-void msg_privmsg(struct client_data *src, const char *dst, const char *msg);
+void msg_join(Client *src, Channel *chan);
+void msg_join_extended(Client *src, Channel *chan);
+void msg_part(Client *src, Channel *chan, const char *reason);
+void msg_topic(Client *src, Channel *chan);
+void msg_invite(Client *src, Client *dst, Channel *chan);
+void msg_kick(Client *src, Client *who, Channel *chan, const char *reason);
+void msg_privmsg(Client *src, const char *dst, const char *msg);
 void msg_privmsg_server(const char *src, const char *dst, const char *msg);
-void msg_notice(struct client_data *src, const char *dst, const char *msg);
+void msg_notice(Client *src, const char *dst, const char *msg);
 void msg_notice_server(const char *src, const char *dst, const char *msg);
-void msg_kill(struct client_data *src, struct client_data *dst, const char *reason);
-void msg_wallops(struct client_data *src, const char *msg);
-void msg_chghost(struct client_data *src, const char *newusername, const char *newhostname);
-void msg_setname(struct client_data *src);
-void msg_account(struct client_data *src);
-void rpl_welcome(struct client_data *client); // 001
-void rpl_yourhost(struct client_data *client); // 002
-void rpl_created(struct client_data *client); // 003
-void rpl_myinfo(struct client_data *client); // 004
-void rpl_isupport(struct client_data *client); // 005
-void rpl_bounce(struct client_data *client, const char *host, const char *port, const char *info); // 010
-void rpl_umodeis(struct client_data *client); // 221
-void rpl_luserclient(struct client_data *client, int users, int invisible, int servers); // 251
-void rpl_luserop(struct client_data *client, int ops); // 252
-void rpl_luserunknown(struct client_data *client, int unk); // 253
-void rpl_luserchannels(struct client_data *client, int channels); // 254
-void rpl_luserme(struct client_data *client, int clients, int servers); // 255
-void rpl_adminme(struct client_data *client); // 256
-void rpl_adminloc1(struct client_data *client, const char *loc); // 257
-void rpl_adminloc2(struct client_data *client, const char *loc); // 258
-void rpl_adminemail(struct client_data *client, const char *email); // 259
-void rpl_tryagain(struct client_data *client, const char *command); // 263
-void rpl_localusers(struct client_data *client, int current, int max); // 265
-void rpl_globalusers(struct client_data *client, int current, int max); // 266
-void rpl_whoiscertfp(struct client_data *client, struct client_data *cl, const char *certfp); // 276
-void rpl_none(struct client_data *client, const char *line); // 300
-void rpl_away(struct client_data *client, struct client_data *cl); // 301
-void rpl_userhost(struct client_data *client, struct client_data **cls, int count); // 302
-void rpl_unaway(struct client_data *client); // 305
-void rpl_nowaway(struct client_data *client); // 306
-void rpl_whoreply(struct client_data *client, struct client_data *cl, struct channel *chan); // 352
-void rpl_whospcrpl(struct client_data *client, struct client_data *cl, struct channel *chan, const char *fmt); // 354
-void rpl_endofwho(struct client_data *client, const char *query); // 315
-void rpl_whoisregnick(struct client_data *client, struct client_data *cl); // 307
-void rpl_whoisuser(struct client_data *client, struct client_data *cl); // 311
-void rpl_whoisserver(struct client_data *client, struct client_data *cl); // 312
-void rpl_whoisoperator(struct client_data *client, struct client_data *cl); // 313
+void msg_kill(Client *src, Client *dst, const char *reason);
+void msg_wallops(Client *src, const char *msg);
+void msg_chghost(Client *src, const char *newusername, const char *newhostname);
+void msg_setname(Client *src);
+void msg_account(Client *src);
+void rpl_welcome(Client *client); // 001
+void rpl_yourhost(Client *client); // 002
+void rpl_created(Client *client); // 003
+void rpl_myinfo(Client *client); // 004
+void rpl_isupport(Client *client); // 005
+void rpl_bounce(Client *client, const char *host, const char *port, const char *info); // 010
+void rpl_umodeis(Client *client); // 221
+void rpl_luserclient(Client *client, int users, int invisible, int servers); // 251
+void rpl_luserop(Client *client, int ops); // 252
+void rpl_luserunknown(Client *client, int unk); // 253
+void rpl_luserchannels(Client *client, int channels); // 254
+void rpl_luserme(Client *client, int clients, int servers); // 255
+void rpl_adminme(Client *client); // 256
+void rpl_adminloc1(Client *client, const char *loc); // 257
+void rpl_adminloc2(Client *client, const char *loc); // 258
+void rpl_adminemail(Client *client, const char *email); // 259
+void rpl_tryagain(Client *client, const char *command); // 263
+void rpl_localusers(Client *client, int current, int max); // 265
+void rpl_globalusers(Client *client, int current, int max); // 266
+void rpl_whoiscertfp(Client *client, Client *cl, const char *certfp); // 276
+void rpl_none(Client *client, const char *line); // 300
+void rpl_away(Client *client, Client *cl); // 301
+void rpl_userhost(Client *client, Client **cls, int count); // 302
+void rpl_unaway(Client *client); // 305
+void rpl_nowaway(Client *client); // 306
+void rpl_whoreply(Client *client, Client *cl, Channel *chan); // 352
+void rpl_whospcrpl(Client *client, Client *cl, Channel *chan, const char *fmt); // 354
+void rpl_endofwho(Client *client, const char *query); // 315
+void rpl_whoisregnick(Client *client, Client *cl); // 307
+void rpl_whoisuser(Client *client, Client *cl); // 311
+void rpl_whoisserver(Client *client, Client *cl); // 312
+void rpl_whoisoperator(Client *client, Client *cl); // 313
 // 314 RPL_WHOWASUSER
-void rpl_whoisidle(struct client_data *client, struct client_data *cl); // 317
-void rpl_endofwhois(struct client_data *client, struct client_data *cl); // 318
-void rpl_whoischannels(struct client_data *client, struct client_data *cl, struct channel *chan); // 319
-void rpl_whoisspecial(struct client_data *client, struct client_data *cl, const char *prefix, const char *info); // 320
-void rpl_liststart(struct client_data *client); // 321
-void rpl_list(struct client_data *client, struct channel *chan); // 322
-void rpl_listend(struct client_data *client); // 323
-void rpl_channelmodeis(struct client_data *client, struct channel *chan); // 324
-void rpl_creationtime(struct client_data *client, struct channel *chan); // 329
-void rpl_whoisaccount(struct client_data *client, struct client_data *cl); // 330
-void rpl_notopic(struct client_data *client, struct channel *chan); // 331
-void rpl_topic(struct client_data *client, struct channel *chan); // 332
-void rpl_topicwhotime(struct client_data *client, struct channel *chan); // 333
-void rpl_whoisbot(struct client_data *client, struct client_data *cl); // 335
-void rpl_invitelist(struct client_data *client, struct channel *chan); // 336
-void rpl_endofinvitelist(struct client_data *client); // 337
-void rpl_whoisactually(struct client_data *client, struct client_data *cl); // 338
-void rpl_inviting(struct client_data *client, struct client_data *cl, struct channel *chan); // 341
-void rpl_invexlist(struct client_data *client, struct channel *chan, const char *mask); // 346
-void rpl_endofinvexlist(struct client_data *client, struct channel *chan); // 347
-void rpl_exceptlist(struct client_data *client, struct channel *chan, const char *mask); // 348
-void rpl_endofexceptlist(struct client_data *client, struct channel *chan); // 349
-void rpl_version(struct client_data *client, const char *ver, const char *comments); // 351
-int rpl_namreply(struct client_data *client, struct channel *chan, struct client_data *cl); // 353
-void rpl_endofnames(struct client_data *client, const char *channel); // 366
+void rpl_whoisidle(Client *client, Client *cl); // 317
+void rpl_endofwhois(Client *client, Client *cl); // 318
+void rpl_whoischannels(Client *client, Client *cl, Channel *chan); // 319
+void rpl_whoisspecial(Client *client, Client *cl, const char *prefix, const char *info); // 320
+void rpl_liststart(Client *client); // 321
+void rpl_list(Client *client, Channel *chan); // 322
+void rpl_listend(Client *client); // 323
+void rpl_channelmodeis(Client *client, Channel *chan); // 324
+void rpl_creationtime(Client *client, Channel *chan); // 329
+void rpl_whoisaccount(Client *client, Client *cl); // 330
+void rpl_notopic(Client *client, Channel *chan); // 331
+void rpl_topic(Client *client, Channel *chan); // 332
+void rpl_topicwhotime(Client *client, Channel *chan); // 333
+void rpl_whoisbot(Client *client, Client *cl); // 335
+void rpl_invitelist(Client *client, Channel *chan); // 336
+void rpl_endofinvitelist(Client *client); // 337
+void rpl_whoisactually(Client *client, Client *cl); // 338
+void rpl_inviting(Client *client, Client *cl, Channel *chan); // 341
+void rpl_invexlist(Client *client, Channel *chan, const char *mask); // 346
+void rpl_endofinvexlist(Client *client, Channel *chan); // 347
+void rpl_exceptlist(Client *client, Channel *chan, const char *mask); // 348
+void rpl_endofexceptlist(Client *client, Channel *chan); // 349
+void rpl_version(Client *client, const char *ver, const char *comments); // 351
+int rpl_namreply(Client *client, Channel *chan, Client *cl); // 353
+void rpl_endofnames(Client *client, const char *channel); // 366
 // 364 RPL_LINKS
 // 365 RPL_ENDOFLINKS
-void rpl_banlist(struct client_data *client, struct channel *chan, const char *mask); // 367
-void rpl_endofbanlist(struct client_data *client, struct channel *chan); // 368
+void rpl_banlist(Client *client, Channel *chan, const char *mask); // 367
+void rpl_endofbanlist(Client *client, Channel *chan); // 368
 // 369 RPL_ENDOFWHOWAS
 // 371 RPL_INFO
 // 374 RPL_ENDOFINFO
-void rpl_motdstart(struct client_data *client); // 375
-void rpl_motd(struct client_data *client, const char *line); // 372
-void rpl_endofmotd(struct client_data *client); // 376
+void rpl_motdstart(Client *client); // 375
+void rpl_motd(Client *client, const char *line); // 372
+void rpl_endofmotd(Client *client); // 376
 // 378 RPL_WHOISHOST
-void rpl_whoismodes(struct client_data *client, struct client_data *cl); // 379
-void rpl_youreoper(struct client_data *client); // 381
+void rpl_whoismodes(Client *client, Client *cl); // 379
+void rpl_youreoper(Client *client); // 381
 // 382 RPL_REHASHING
-void rpl_time(struct client_data *client, time_t ts); // 391
-void rpl_visiblehost(struct client_data *client); // 396
-void err_unknownerror(struct client_data *client, const char *command, const char *msg); // 400
-void err_nosuchnick(struct client_data *client, const char *nick); // 401
-void err_nosuchserver(struct client_data *client, const char *server); // 402
-void err_nosuchchannel(struct client_data *client, const char *channel); // 403
-void err_cannotsendtochan(struct client_data *client, const char *channel); // 404
-void err_toomanychannels(struct client_data *client, const char *channel); // 405
-void err_wasnosuchnick(struct client_data *client); // 406
-void err_noorigin(struct client_data *client); // 409
-void err_inputtoolong(struct client_data *client); // 417
-void err_unknowncommand(struct client_data *client, const char *command); // 421
-void err_nomotd(struct client_data *client); // 422
-void err_erroneusnickname(struct client_data *client, const char *nick); // 432
-void err_nicknameinuse(struct client_data *client, const char *nick); // 433
-void err_usernotinchannel(struct client_data *client, const char *nick, struct channel *chan); // 441
-void err_notonchannel(struct client_data *client, struct channel *chan); // 442
-void err_useronchannel(struct client_data *client, const char *nick, struct channel *chan); // 443
-void err_notregistered(struct client_data *client); // 451
-void err_needmoreparams(struct client_data *client, const char *command); // 461
-void err_alreadyregistered(struct client_data *client); // 462
-void err_passwdmismatch(struct client_data *client); // 464
-void err_yourebannedcreep(struct client_data *client); // 465
-void err_channelisfull(struct client_data *client, struct channel *chan); // 471
-void err_unknownmode(struct client_data *client, char mode); // 472
-void err_inviteonlychan(struct client_data *client, struct channel *chan); // 473
-void err_bannedfromchan(struct client_data *client, struct channel *chan); // 474
-void err_badchannelkey(struct client_data *client, struct channel *chan); // 475
-void err_badchanmask(struct client_data *client, const char *channel); // 476
-void err_noprivileges(struct client_data *client); // 481
-void err_chanoprivsneeded(struct client_data *client, struct channel *chan); // 481
+void rpl_time(Client *client, time_t ts); // 391
+void rpl_visiblehost(Client *client); // 396
+void err_unknownerror(Client *client, const char *command, const char *msg); // 400
+void err_nosuchnick(Client *client, const char *nick); // 401
+void err_nosuchserver(Client *client, const char *server); // 402
+void err_nosuchchannel(Client *client, const char *channel); // 403
+void err_cannotsendtochan(Client *client, const char *channel); // 404
+void err_toomanychannels(Client *client, const char *channel); // 405
+void err_wasnosuchnick(Client *client); // 406
+void err_noorigin(Client *client); // 409
+void err_inputtoolong(Client *client); // 417
+void err_unknowncommand(Client *client, const char *command); // 421
+void err_nomotd(Client *client); // 422
+void err_erroneusnickname(Client *client, const char *nick); // 432
+void err_nicknameinuse(Client *client, const char *nick); // 433
+void err_usernotinchannel(Client *client, const char *nick, Channel *chan); // 441
+void err_notonchannel(Client *client, Channel *chan); // 442
+void err_useronchannel(Client *client, const char *nick, Channel *chan); // 443
+void err_notregistered(Client *client); // 451
+void err_needmoreparams(Client *client, const char *command); // 461
+void err_alreadyregistered(Client *client); // 462
+void err_passwdmismatch(Client *client); // 464
+void err_yourebannedcreep(Client *client); // 465
+void err_channelisfull(Client *client, Channel *chan); // 471
+void err_unknownmode(Client *client, char mode); // 472
+void err_inviteonlychan(Client *client, Channel *chan); // 473
+void err_bannedfromchan(Client *client, Channel *chan); // 474
+void err_badchannelkey(Client *client, Channel *chan); // 475
+void err_badchanmask(Client *client, const char *channel); // 476
+void err_noprivileges(Client *client); // 481
+void err_chanoprivsneeded(Client *client, Channel *chan); // 481
 // 483 ERR_CANTKILLSERVER
 // 491 ERR_NOOPERHOST
-void err_umodeunknownflag(struct client_data *client); // 501
-void err_usersdontmatch(struct client_data *client, const char *what); // 502
-void err_helpnotfound(struct client_data *client); // 524
-void err_invalidkey(struct client_data *client, struct channel *chan); // 525
-void err_cantsendtouser(struct client_data *client, struct client_data *cl); // 531
+void err_umodeunknownflag(Client *client); // 501
+void err_usersdontmatch(Client *client, const char *what); // 502
+void err_helpnotfound(Client *client); // 524
+void err_invalidkey(Client *client, Channel *chan); // 525
+void err_cantsendtouser(Client *client, Client *cl); // 531
 // 670 RPL_STARTTLS
 // 671 RPL_WHOISSECURE
 // 691 ERR_STARTTLS
 // 696 ERR_INVALIDMODEPARAM
-void rpl_helpstart(struct client_data *client); // 704
-void rpl_helptxt(struct client_data *client, const char *line); // 705
-void rpl_endofhelp(struct client_data *client); // 706
+void rpl_helpstart(Client *client); // 704
+void rpl_helptxt(Client *client, const char *line); // 705
+void rpl_endofhelp(Client *client); // 706
 // 723 ERR_NOPRIVS
-void rpl_quietlist(struct client_data *client, struct channel *chan, const char *mask); // 728
-void rpl_endofquietlist(struct client_data *client, struct channel *chan); // 729
-void rpl_mononline(struct client_data *client, struct client_data *cl); // 730
-void rpl_monoffline(struct client_data *client, const char *nick); // 731
-void rpl_monlist(struct client_data *client, const char *nick); // 732
-void rpl_endofmonlist(struct client_data *client); // 733
-void rpl_monlistfull(struct client_data *client, int limit, const char *targets); // 734
-void rpl_loggedin(struct client_data *client); // 900
-void rpl_loggedout(struct client_data *client); // 901
+void rpl_quietlist(Client *client, Channel *chan, const char *mask); // 728
+void rpl_endofquietlist(Client *client, Channel *chan); // 729
+void rpl_mononline(Client *client, Client *cl); // 730
+void rpl_monoffline(Client *client, const char *nick); // 731
+void rpl_monlist(Client *client, const char *nick); // 732
+void rpl_endofmonlist(Client *client); // 733
+void rpl_monlistfull(Client *client, int limit, const char *targets); // 734
+void rpl_loggedin(Client *client); // 900
+void rpl_loggedout(Client *client); // 901
 // 902 ERR_NICKLOCKED
 void rpl_saslsuccess(void); // 903
 void err_saslfail(void); // 904
@@ -158,6 +158,6 @@ void err_sasltoolong(void); // 905
 void err_saslaborted(void); // 906
 void err_saslalready(void); // 907
 void rpl_saslmechs(void); // 908
-void rpl_accesslist(struct client_data *client, struct channel *chan, char mode, const char *mask); // 910
-void rpl_endofaccesslist(struct client_data *client, struct channel *chan); // 911
+void rpl_accesslist(Client *client, Channel *chan, char mode, const char *mask); // 910
+void rpl_endofaccesslist(Client *client, Channel *chan); // 911
 #endif
index fb0cdc4..597b9f6 100644 (file)
@@ -5,7 +5,7 @@
 #include "passwd.hpp"
 
 struct jobent {
-       struct client_data *client;
+       Client *client;
        jobproc_t job;
        contproc_t then;
        char *data;
@@ -78,14 +78,14 @@ void job_process(void)
        }
 }
 
-void job_add(struct client_data *cl, jobproc_t job, contproc_t then, char *data, size_t len)
+void job_add(Client *cl, jobproc_t job, contproc_t then, char *data, size_t len)
 {
        if (!job)
                return;
        struct jobent ent = { cl, job, then, data, len };
        jobq.push_back(ent);
 }
-void job_kill(struct client_data *cl)
+void job_kill(Client *cl)
 {
        if (!jobq.empty() && jobq.front().client == cl)
                current_child = -1;
@@ -103,7 +103,7 @@ void job_kill(struct client_data *cl)
        jobq.erase(q, jobq.end());
 }
 
-static int job_password_check_job(struct client_data *cl, const char *data, size_t len)
+static int job_password_check_job(Client *cl, const char *data, size_t len)
 {
        (void)cl;
        if (!len)
@@ -116,7 +116,7 @@ static int job_password_check_job(struct client_data *cl, const char *data, size
                memset(hash, 0, strlen(hash));
        return rv;
 }
-void job_password_check(struct client_data *client, const char *key, const char *pw, const char *fn, contproc_t then)
+void job_password_check(Client *client, const char *key, const char *pw, const char *fn, contproc_t then)
 {
        char *salt = password_get(key, fn);
        if (!salt) {
index 1da443a..6346f83 100644 (file)
@@ -2,12 +2,12 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 #ifndef JOB_H_
 #define JOB_H_
-typedef int (*jobproc_t)(struct client_data *cl, const char *data, size_t len);
-typedef void (*contproc_t)(struct client_data *cl, int res);
+typedef int (*jobproc_t)(Client *cl, const char *data, size_t len);
+typedef void (*contproc_t)(Client *cl, int res);
 void job_init(void);
 void job_fini(void);
 void job_process(void);
-void job_add(struct client_data *client, jobproc_t job, contproc_t then, char *data, size_t len);
-void job_kill(struct client_data *client);
-void job_password_check(struct client_data *client, const char *key, const char *pw, const char *fn, contproc_t then);
+void job_add(Client *client, jobproc_t job, contproc_t then, char *data, size_t len);
+void job_kill(Client *client);
+void job_password_check(Client *client, const char *key, const char *pw, const char *fn, contproc_t then);
 #endif
index 6a7253f..7cb6e89 100644 (file)
@@ -11,7 +11,7 @@
 static int is_running = 1;
 
 // Client linked list
-struct client_data *clients = NULL, *dyingclients = NULL;
+Client *clients = NULL, *dyingclients = NULL;
 
 FILE *fchanlog = NULL;
 
@@ -141,7 +141,7 @@ static void accept_from_sock(struct listener *listener)
 #endif
                }
                // Add to list of sockets
-               client_data *cl = new client_data();
+               Client *cl = new Client();
                cl->fd = fd;
                cl->cctx = cctx;
                cl->peername = mystrdup(client_addr);
@@ -290,7 +290,7 @@ int main(int argc, char *argv[])
 
        FILE *f = fopen(getdatafile("init.txt"), "rbe");
        if (f) {
-               client_data *fake = new client_data();
+               Client *fake = new Client();
                fake->fd = -1;
                fake->umode |= UMODE_OPER | UMODE_SECURE;
                fake->hostname = mystrdup("localhost");
@@ -350,8 +350,8 @@ int main(int argc, char *argv[])
                        for (listener &listener : listeners) {
                                netpoll::del_and_close(listener.fd);
                        }
-                       for (struct client_data *cl = clients; cl;) {
-                               struct client_data *next = cl->next;
+                       for (Client *cl = clients; cl;) {
+                               Client *next = cl->next;
                                killConnection(cl, 0);
                                cl = next;
                        }
@@ -375,7 +375,7 @@ int main(int argc, char *argv[])
                                        accept_from_sock((struct listener *)ev.assoc);
                                break;
                        case SOCKTYPE_CLIENT: {
-                               struct client_data *cl = (struct client_data *)ev.assoc;
+                               Client *cl = (Client *)ev.assoc;
                                /* NOTE: read_proc can kill the client, so writing should be done first. */
                                if ((cl->want_read_for_write && isr) || (cl->want_write_for_write && isw))
                                        sendClient(cl, 0, 0);
@@ -384,7 +384,7 @@ int main(int argc, char *argv[])
                                break;
                        }
                        case SOCKTYPE_DYING: {
-                               struct client_data *cl = (struct client_data *)ev.assoc;
+                               Client *cl = (Client *)ev.assoc;
                                if (cl->wlen)
                                        if ((cl->want_read_for_write && isr) || (cl->want_write_for_write && isw))
                                                sendClient(cl, 0, 0);
@@ -400,8 +400,8 @@ int main(int argc, char *argv[])
                }
 
                /* Clean up write error clients */
-               for (struct client_data *cl = clients; cl;) {
-                       struct client_data *next = cl->next;
+               for (Client *cl = clients; cl;) {
+                       Client *next = cl->next;
                        if (cl->write_error)
                                killConnection(cl, 0);
                        cl = next;
index 243e504..5530dc6 100644 (file)
@@ -109,15 +109,15 @@ public:
        }
 };
 
-struct client_data;
-struct clientmap : map_base2<clientmap, struct client_data *> {
-       void rename(struct client_data *v, const char *newk) {
+struct Client;
+struct clientmap : map_base2<clientmap, Client *> {
+       void rename(Client *v, const char *newk) {
                if (remove(v) && _set(newk, v, 0) == -1)
                        abortf("clientmap::rename: allocation failure\n");
        }
 };
-struct channel;
-struct channelmap : map_base2<channelmap, struct channel *> {
+struct Channel;
+struct channelmap : map_base2<channelmap, Channel *> {
 };
 struct stringset : map_base2<stringset, const char *> {
 protected:
index a8d3da7..97554f0 100644 (file)
@@ -8,7 +8,7 @@
 #include "ircfmt.hpp"
 #include "job.hpp"
 #include "admin.hpp"
-void update_poll_reg(struct client_data *cl)
+void update_poll_reg(Client *cl)
 {
        if (cl->fd == -1)
                return;
@@ -34,7 +34,7 @@ void update_poll_reg(struct client_data *cl)
        }
 }
 
-void log_client(struct client_data *cl, const char *format, ...)
+void log_client(Client *cl, const char *format, ...)
 {
        va_list ap;
        va_start(ap, format);
@@ -43,7 +43,7 @@ void log_client(struct client_data *cl, const char *format, ...)
        va_end(ap);
 }
 
-void killConnection(struct client_data *cl, int byChoice)
+void killConnection(Client *cl, int byChoice)
 {
        if (!cl)
                return;
@@ -61,7 +61,7 @@ void killConnection(struct client_data *cl, int byChoice)
        msg_error("Closing Link");
        sendbuf(cl);
        /* Move the client to the dyingclients chain */
-       for (struct client_data **next = &clients; *next; next = &(*next)->next) {
+       for (Client **next = &clients; *next; next = &(*next)->next) {
                if (*next == cl) {
                        *next = cl->next;
                        break;
@@ -90,7 +90,7 @@ void killConnection(struct client_data *cl, int byChoice)
        cl->monitor.clear();
        killConnectionPart2(cl);
 }
-void killConnectionPart2(struct client_data *cl)
+void killConnectionPart2(Client *cl)
 {
        if (cl->want_read_for_write || cl->want_write_for_write) {
                /* We're still waiting for a pending write.
@@ -123,7 +123,7 @@ void killConnectionPart2(struct client_data *cl)
                netpoll::del_and_close(cl->fd);
        }
        /* Remove the client from the dyingclients chain */
-       for (struct client_data **next = &dyingclients; *next; next = &(*next)->next) {
+       for (Client **next = &dyingclients; *next; next = &(*next)->next) {
                if (*next == cl) {
                        *next = cl->next;
                        break;
@@ -151,7 +151,7 @@ void killConnectionPart2(struct client_data *cl)
        delete cl;
 }
 
-void read_proc(struct client_data *cl)
+void read_proc(Client *cl)
 {
        constexpr int rcap = sizeof(cl->rbuf);
        cl->want_write_for_read = 0;
@@ -215,7 +215,7 @@ void read_proc(struct client_data *cl)
 
 /* returns the count of bytes which were not sent, or -1 on error.
  * updates want_read_for_write and want_write_for_write */
-static int sendClientRaw(struct client_data *cl, const char *buf, size_t len)
+static int sendClientRaw(Client *cl, const char *buf, size_t len)
 {
        cl->want_read_for_write = 0;
        cl->want_write_for_write = 0;
@@ -259,7 +259,7 @@ static int sendClientRaw(struct client_data *cl, const char *buf, size_t len)
        return len;
 }
 
-void sendClient(struct client_data *cl, const char *buf, size_t len)
+void sendClient(Client *cl, const char *buf, size_t len)
 {
        if (cl->write_error)
                return;
index e8285d2..d1b02dc 100644 (file)
@@ -3,12 +3,12 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 #ifndef NET_H_
 #define NET_H_
-void sendbuf(struct client_data *client);
-void sendbuf_visible(struct client_data *client);
-void update_poll_reg(struct client_data *cl);
-void log_client(struct client_data *cl, const char *format, ...);
-void killConnection(struct client_data *client, int byChoice);
-void killConnectionPart2(struct client_data *cl);
-void read_proc(struct client_data *cl);
-void sendClient(struct client_data *cl, const char *buf, size_t len);
+void sendbuf(Client *client);
+void sendbuf_visible(Client *client);
+void update_poll_reg(Client *cl);
+void log_client(Client *cl, const char *format, ...);
+void killConnection(Client *client, int byChoice);
+void killConnectionPart2(Client *cl);
+void read_proc(Client *cl);
+void sendClient(Client *cl, const char *buf, size_t len);
 #endif