]> jfr.im git - solanum.git/blobdiff - modules/m_cap.c
modules: chase MsgBuf API change
[solanum.git] / modules / m_cap.c
index b79b792c3b7f8c2815c98750121b4f604dce2265..0860dfd8a48024ef0e8af399b2ba852f61820159 100644 (file)
@@ -47,7 +47,7 @@
 
 typedef int (*bqcmp)(const void *, const void *);
 
-static int m_cap(struct Client *, struct Client *, int, const char **);
+static int m_cap(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 static int modinit(void);
 
 struct Message cap_msgtab = {
@@ -80,6 +80,7 @@ static struct clicap
        _CLICAP("tls", CLICAP_TLS, 0, 0, 0),
        _CLICAP("userhost-in-names", CLICAP_USERHOST_IN_NAMES, 0, 0, 0),
        _CLICAP("cap-notify", CLICAP_CAP_NOTIFY, 0, 0, 0),
+       _CLICAP("chghost", CLICAP_CHGHOST, 0, 0, 0),
 };
 
 #define CLICAP_LIST_LEN (sizeof(clicap_list) / sizeof(struct clicap))
@@ -186,7 +187,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
        int curlen, mlen;
        size_t i;
 
-       mlen = rb_sprintf(buf, ":%s CAP %s %s",
+       mlen = sprintf(buf, ":%s CAP %s %s",
                        me.name,
                        EmptyString(source_p->name) ? "*" : source_p->name,
                        subcmd);
@@ -246,7 +247,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
                        buflen++;
                }
 
-               curlen = rb_sprintf(p, "%s ", clicap_list[i].name);
+               curlen = sprintf(p, "%s ", clicap_list[i].name);
                p += curlen;
                buflen += curlen;
        }
@@ -317,9 +318,7 @@ cap_end(struct Client *source_p, const char *arg)
 
        if(source_p->name[0] && source_p->flags & FLAGS_SENTUSER)
        {
-               char buf[USERLEN+1];
-               rb_strlcpy(buf, source_p->username, sizeof(buf));
-               register_local_user(source_p, source_p, buf);
+               register_local_user(source_p, source_p);
        }
 }
 
@@ -358,7 +357,7 @@ cap_req(struct Client *source_p, const char *arg)
        if(EmptyString(arg))
                return;
 
-       buflen = rb_snprintf(buf, sizeof(buf), ":%s CAP %s ACK",
+       buflen = snprintf(buf, sizeof(buf), ":%s CAP %s ACK",
                        me.name, EmptyString(source_p->name) ? "*" : source_p->name);
 
        pbuf[0][0] = '\0';
@@ -427,8 +426,10 @@ cap_req(struct Client *source_p, const char *arg)
                }
 
                strcat(pbuf[i], cap->name);
-               strcat(pbuf[i], " ");
-               plen += (cap->namelen + 1);
+               if (!finished) {
+                       strcat(pbuf[i], " ");
+                       plen += (cap->namelen + 1);
+               }
        }
 
        if(!finished)
@@ -471,7 +472,7 @@ clicap_cmd_search(const char *command, struct clicap_cmd *entry)
 }
 
 static int
-m_cap(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+m_cap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        struct clicap_cmd *cmd;