]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/client.c
Send only one ERR_MLOCKRESTRICTED per MODE command.
[irc/rqf/shadowircd.git] / src / client.c
index d22c7ef8c562cc8d9cecdd92663b4edb0e6ecb5d..9e8c737dd3bf74e8723e11556eb9367b4d77c180 100644 (file)
@@ -22,7 +22,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: client.c 3514 2007-06-06 16:25:21Z nenolod $
  */
 #include "stdinc.h"
 #include "config.h"
@@ -424,10 +423,10 @@ notify_banned_client(struct Client *client_p, struct ConfItem *aconf, int ban)
        const char *reason = NULL;
        const char *exit_reason = conn_closed;
 
-       if(ConfigFileEntry.kline_with_reason && !EmptyString(aconf->passwd))
+       if(ConfigFileEntry.kline_with_reason)
        {
-               reason = aconf->passwd;
-               exit_reason = aconf->passwd;
+               reason = get_user_ban_reason(aconf);
+               exit_reason = reason;
        }
        else
        {
@@ -1146,6 +1145,9 @@ exit_generic_client(struct Client *client_p, struct Client *source_p, struct Cli
        if(IsOper(source_p))
                rb_dlinkFindDestroy(source_p, &oper_list);
 
+       /* get rid of any metadata the user may have */
+       user_metadata_clear(source_p);
+
        sendto_common_channels_local(source_p, ":%s!%s@%s QUIT :%s",
                                     source_p->name,
                                     source_p->username, source_p->host, comment);
@@ -1709,14 +1711,6 @@ free_user(struct User *user, struct Client *client_p)
 {
        free_away(client_p);
 
-       /* get rid of any metadata the user may have */
-       if(IsOper(client_p))
-       {
-               user_metadata_delete(client_p, "swhois", 0);
-               user_metadata_delete(client_p, "operstring", 0);
-       }
-       user_metadata_delete(client_p, "OACCEPT", 0);
-
        if(--user->refcnt <= 0)
        {
                if(user->away)
@@ -1954,9 +1948,6 @@ user_metadata_add(struct Client *target, const char *name, const char *value, in
 {
        struct Metadata *md;
 
-       if(irc_dictionary_find(target->user->metadata, name) != NULL)
-               return NULL;
-
        md = rb_malloc(sizeof(struct Metadata));
        md->name = rb_strdup(name);
        md->value = rb_strdup(value);
@@ -1965,7 +1956,7 @@ user_metadata_add(struct Client *target, const char *name, const char *value, in
        
        if(propegate)
                sendto_match_servs(&me, "*", CAP_ENCAP, NOCAPS, "ENCAP * METADATA ADD %s %s :%s",
-                               target->name, name, value);
+                               target->id, name, value);
 
        return md;
 }
@@ -1993,7 +1984,7 @@ user_metadata_delete(struct Client *target, const char *name, int propegate)
 
        if(propegate)
                sendto_match_servs(&me, "*", CAP_ENCAP, NOCAPS, "ENCAP * METADATA DELETE %s %s",
-                               target->name, name);
+                               target->id, name);
 }
 
 /*
@@ -2015,3 +2006,21 @@ user_metadata_find(struct Client *target, const char *name)
 
        return irc_dictionary_retrieve(target->user->metadata, name);
 }
+/*
+ * user_metadata_clear
+ * 
+ * inputs      - pointer to user struct
+ * output      - none
+ * side effects - metadata is cleared from the user in question
+ */
+void
+user_metadata_clear(struct Client *target)
+{
+       struct Metadata *md;
+       struct DictionaryIter iter;
+       
+       DICTIONARY_FOREACH(md, &iter, target->user->metadata)
+       {
+               user_metadata_delete(target, md->name, 0);
+       }
+}