]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_presence.c
Disallow changing away status via /presence.
[irc/rqf/shadowircd.git] / modules / m_presence.c
index 4873d3ee6fb837585b354b4115e7ddf3fa2b230d..41c5e8adea382d39a914d5d8295fa0c08be34c0b 100644 (file)
@@ -43,7 +43,7 @@ static int me_presence(struct Client *, struct Client *, int, const char **);
 
 struct Message presence_msgtab = {
        "PRESENCE", 0, 0, 0, MFLG_SLOW,
-       {mg_unreg, {m_presence, 1}, {m_presence, 1}, mg_ignore, {me_presence, 1}, {m_presence, 1}}
+       {mg_unreg, {m_presence, 2}, {m_presence, 2}, mg_ignore, {me_presence, 2}, {m_presence, 2}}
 };
 
 mapi_clist_av1 presence_clist[] = { &presence_msgtab, NULL };
@@ -65,6 +65,12 @@ m_presence(struct Client *client_p, struct Client *source_p, int parc, const cha
        if(!IsClient(source_p))
                return 0;
 
+       if (!irccmp(parv[1], "away"))
+       {
+               sendto_one_notice(source_p, ":Please use /AWAY to change your away status");
+               return 0;
+       }
+
        if((parc < 3 || EmptyString(parv[2])) && !EmptyString(parv[1]))
        {
                if ((val = get_metadata(source_p, parv[1])) != NULL)
@@ -79,6 +85,12 @@ m_presence(struct Client *client_p, struct Client *source_p, int parc, const cha
                return 0;
        }
 
+       if (strlen(parv[1]) >= METADATAKEYLEN)
+       {
+               sendto_one_notice(source_p, ":Metadata key too long");
+               return 0;
+       }
+
        if ((val = get_metadata(source_p, parv[1])) != NULL)
        {
                if (!strcmp(parv[2], val))
@@ -114,6 +126,9 @@ me_presence(struct Client *client_p, struct Client *source_p, int parc, const ch
                return 0;
        }
 
+       if (strlen(parv[1]) >= METADATAKEYLEN)
+               return 0;
+
        if ((val = get_metadata(source_p, parv[1])) != NULL)
        {
                if (!strcmp(parv[2], val))