]> PatchyGit - patchyircd.git/commitdiff
add biboumi hostname support
authorEgor <egor@patchysicp.xyz>
Mon, 12 Aug 2024 18:47:37 +0000 (21:47 +0300)
committerEgor <egor@patchysicp.xyz>
Mon, 12 Aug 2024 18:47:37 +0000 (21:47 +0300)
src/admin.c
src/common.h
src/irc.c
src/net.c

index ab8ef63..4f4a56f 100644 (file)
@@ -147,6 +147,7 @@ static int client_index(lua_State *L)
        /* saslbufLen */
        /* saslusername */
        /* webircpeername */
+       /* webirchostname */
        /* buf/bufLen/wbuf/wbufLen */
        integer_getter(cl, umode);
        integer_getter(cl, regstate);
index 7e94d07..f2d98c8 100644 (file)
@@ -52,6 +52,7 @@ struct client_data {
        size_t saslbufLen;
        char   *saslusername;
        char   *webircpeername;
+       char   *webirchostname;
        char   buf[2048];
        size_t bufLen;
        char   wbuf[8192];
index df370c2..bd76c36 100644 (file)
--- a/src/irc.c
+++ b/src/irc.c
@@ -191,6 +191,11 @@ static void cont_webirc(struct client_data *client, int res) {
        } else {
                free(client->peername);
                client->peername = client->webircpeername;
+               if (client->webirchostname) {
+                       client_chghost(client, 0, client->webirchostname);
+                       free(client->webirchostname);
+                       client->webirchostname = 0;
+               }
                client->webircpeername = 0;
                if (client->webircwait == 2) {
                        // NOTE: this relies on the job system being FIFO
@@ -499,6 +504,14 @@ saslcleanup:
                                client->webircwait = 1;
                        else
                                client->webircwait = 2;
+                       if (!strcmp(args[1], "biboumi")) {
+                               int len = strlen(args[2]);
+                               client->webirchostname = malloc(len+sizeof(".xmpp"));
+                               if (client->webirchostname) {
+                                       memcpy(client->webirchostname, args[2], len);
+                                       memcpy(client->webirchostname+len, ".xmpp", sizeof(".xmpp"));
+                               }
+                       }
                        job_password_check(client, args[1], args[0], getdatafile("webirc.txt"), cont_webirc);
                        memset(args[0], 0, strlen(args[0]));
                }
index ddd9b00..32d93e7 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -143,6 +143,7 @@ void killConnectionPart2(struct client_data *cl)
        free(cl->saslbuf);
        free(cl->saslusername);
        free(cl->webircpeername);
+       free(cl->webirchostname);
        free(cl);
 }