]> jfr.im git - solanum.git/blobdiff - modules/m_cap.c
sasl: reformat the other messages consistently
[solanum.git] / modules / m_cap.c
index 93830cf3b8b360dd7e41a4b3d02db40f892272c6..ad9d95f84922e58a6cbccfa1f72f748b9e36aa3a 100644 (file)
@@ -42,6 +42,8 @@
 #include "s_serv.h"
 #include "s_user.h"
 #include "send.h"
+#include "s_conf.h"
+#include "hash.h"
 
 typedef int (*bqcmp)(const void *, const void *);
 
@@ -77,6 +79,7 @@ static struct clicap
        _CLICAP("away-notify", CLICAP_AWAY_NOTIFY, 0, 0, 0),
        _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),
 };
 
 #define CLICAP_LIST_LEN (sizeof(clicap_list) / sizeof(struct clicap))
@@ -209,6 +212,18 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
                                continue;
                }
 
+               if (clicap_list[i].cap_serv == CLICAP_SASL)
+               {
+                       struct Client *agent_p = NULL;
+
+                       if (!ConfigFileEntry.sasl_service)
+                               continue;
+
+                       agent_p = find_named_client(ConfigFileEntry.sasl_service);
+                       if (agent_p == NULL || !IsService(agent_p))
+                               continue;
+               }
+
                /* \r\n\0, possible "-~=", space, " *" */
                if(buflen + clicap_list[i].namelen >= BUFSIZE - 10)
                {
@@ -410,6 +425,24 @@ cap_req(struct Client *source_p, const char *arg)
                                break;
                        }
 
+                       if (cap->cap_serv == CLICAP_SASL)
+                       {
+                               struct Client *agent_p = NULL;
+
+                               if (!ConfigFileEntry.sasl_service)
+                               {
+                                       finished = 0;
+                                       break;
+                               }
+
+                               agent_p = find_named_client(ConfigFileEntry.sasl_service);
+                               if (agent_p == NULL || !IsService(agent_p))
+                               {
+                                       finished = 0;
+                                       break;
+                               }
+                       }
+
                        if(cap->flags & CLICAP_FLAGS_STICKY)
                        {
                                strcat(pbuf[i], "=");