]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-metadata.c
Send "fake '*' key" in "MODE -k" replies
[ngircd-alex.git] / src / ngircd / irc-metadata.c
index d64ffb2178c8fff634e377a1c82964135cde9956..f7948e6a0d42cbabcdcd1f2a5e0db6731720884e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -51,26 +51,22 @@ IRC_METADATA(CLIENT *Client, REQUEST *Req)
        assert(Client != NULL);
        assert(Req != NULL);
 
-       if (Req->argc != 3)
-               return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
-                                         Client_ID(Client), Req->command);
-
        prefix = Client_Search(Req->prefix);
        if (!prefix)
-               return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+               return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
                                          Client_ID(Client), Req->prefix);
 
        target = Client_Search(Req->argv[0]);
        if (!target)
-               return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+               return IRC_WriteErrClient(Client, ERR_NOSUCHNICK_MSG,
                                          Client_ID(Client), Req->argv[0]);
 
        LogDebug("Got \"METADATA\" command from \"%s\" for client \"%s\": \"%s=%s\".",
                 Client_ID(prefix), Client_ID(target),
                 Req->argv[1], Req->argv[2]);
 
-       /* Mark client: it has receiveda a METADATA command */
-       if (!strchr(Client_Flags(target), 'M')) {
+       /* Mark client: it has received a METADATA command */
+       if (!Client_HasFlag(target, 'M')) {
                snprintf(new_flags, sizeof new_flags, "%sM",
                         Client_Flags(target));
                Client_SetFlags(target, new_flags);
@@ -96,8 +92,10 @@ IRC_METADATA(CLIENT *Client, REQUEST *Req)
                Client_SetInfo(target, Req->argv[2]);
        else if (*Req->argv[2] && strcasecmp(Req->argv[1], "user") == 0)
                Client_SetUser(target, Req->argv[2], true);
+       else if (strcasecmp(Req->argv[1], "accountname") == 0)
+               Client_SetAccountName(target, Req->argv[2]);
        else if (*Req->argv[2] && strcasecmp(Req->argv[1], "certfp") == 0)
-               Conn_SetFingerprint(Client_Conn(target), Req->argv[2]);
+               Conn_SetCertFp(Client_Conn(target), Req->argv[2]);
        else
                Log(LOG_WARNING,
                    "Ignored metadata update from \"%s\" for client \"%s\": \"%s=%s\" - unknown key!",