]> jfr.im git - solanum.git/blobdiff - extensions/m_webirc.c
Merge pull request #293 from edk0/webirc
[solanum.git] / extensions / m_webirc.c
index 1f3a96acfc61159992e086d0c5bee8a677a1a87f..04f59c96ae58babd4558e77806dd7f050c38376e 100644 (file)
@@ -64,7 +64,13 @@ struct Message webirc_msgtab = {
 
 mapi_clist_av1 webirc_clist[] = { &webirc_msgtab, NULL };
 
-DECLARE_MODULE_AV2(webirc, NULL, NULL, webirc_clist, NULL, NULL, NULL, NULL, webirc_desc);
+static void new_local_user(void *data);
+mapi_hfn_list_av1 webirc_hfnlist[] = {
+       { "new_local_user", (hookfn) new_local_user },
+       { NULL, NULL }
+};
+
+DECLARE_MODULE_AV2(webirc, NULL, NULL, webirc_clist, NULL, webirc_hfnlist, NULL, NULL, webirc_desc);
 
 /*
  * mr_webirc - webirc message handler
@@ -102,7 +108,7 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
        }
        if (!IsSSL(source_p) && aconf->flags & CONF_FLAGS_NEED_SSL)
        {
-               sendto_one(source_p, "NOTICE * :Your CGI:IRC block requires SSL");
+               sendto_one(source_p, "NOTICE * :Your CGI:IRC block requires TLS");
                return;
        }
 
@@ -140,7 +146,7 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
        if (secure && !IsSSL(source_p))
        {
                sendto_one(source_p, "NOTICE * :CGI:IRC is not connected securely; marking you as insecure");
-               return 0;
+               secure = 0;
        }
 
        if (!secure)
@@ -168,3 +174,13 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
 
        sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]);
 }
+
+static void
+new_local_user(void *data)
+{
+       struct Client *source_p = data;
+       struct ConfItem *aconf = source_p->localClient->att_conf;
+
+       if (!irccmp(aconf->info.name, "webirc."))
+               exit_client(source_p, source_p, &me, "Cannot log in using a WEBIRC block");
+}