]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_list.c
mkpasswd: Default to SHA512 instead of inherently insecure DES.
[irc/rqf/shadowircd.git] / modules / m_list.c
index 933c571ce97b319e381e87e3b1f714b1342ee376..91a16787c6c2a4a16aaaccd9faffb945c16e8b15 100644 (file)
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $Id: m_list.c 3372 2007-04-03 10:18:07Z nenolod $
  */
 
 #include "stdinc.h"
-#include "tools.h"
 #include "channel.h"
 #include "client.h"
 #include "hash.h"
-#include "irc_string.h"
+#include "match.h"
 #include "ircd.h"
 #include "numeric.h"
 #include "s_conf.h"
@@ -47,7 +45,6 @@
 #include "msg.h"
 #include "parse.h"
 #include "modules.h"
-#include "event.h"
 
 static rb_dlink_list safelisting_clients = { NULL, NULL, 0 };
 
@@ -79,16 +76,18 @@ mapi_hfn_list_av1 list_hfnlist[] = {
 
 DECLARE_MODULE_AV1(list, _modinit, _moddeinit, list_clist, NULL, list_hfnlist, "$Revision: 3372 $");
 
+static struct ev_entry *iterate_clients_ev = NULL;
+
 static int _modinit(void)
 {
-       eventAdd("safelist_iterate_clients", safelist_iterate_clients, NULL, 3);
+       iterate_clients_ev = rb_event_add("safelist_iterate_clients", safelist_iterate_clients, NULL, 3);
 
        return 0;
 }
 
 static void _moddeinit(void)
 {
-       eventDelete(safelist_iterate_clients, NULL);
+       rb_event_delete(iterate_clients_ev);
 }
 
 static void safelist_check_cliexit(hook_data_client_exit * hdata)
@@ -103,7 +102,6 @@ static void safelist_check_cliexit(hook_data_client_exit * hdata)
 }
 
 /* m_list()
- *      parv[0] = sender prefix
  *      parv[1] = channel
  *
  * XXX - With SAFELIST, do we really need to continue pacing?
@@ -124,21 +122,20 @@ static int m_list(struct Client *client_p, struct Client *source_p, int parc, co
        if (parc < 2 || !IsChannelName(parv[1]))
        {
                /* pace this due to the sheer traffic involved */
-               if (((last_used + ConfigFileEntry.pace_wait) > CurrentTime))
+               if (((last_used + ConfigFileEntry.pace_wait) > rb_current_time()))
                {
                        sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "LIST");
                        sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
                        return 0;
                }
                else
-                       last_used = CurrentTime;
+                       last_used = rb_current_time();
        }
 
        return mo_list(client_p, source_p, parc, parv);
 }
 
 /* mo_list()
- *      parv[0] = sender prefix
  *      parv[1] = channel
  */
 static int mo_list(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
@@ -155,8 +152,8 @@ static int mo_list(struct Client *client_p, struct Client *source_p, int parc, c
                return 0;
        }
 
-       /* XXX rather arbitrary -- jilles */
-       params.users_min = 3;
+       /* Let the user set it */
+       params.users_min = ConfigFileEntry.hide_channel_below_users;
        params.users_max = INT_MAX;
 
        if (parc > 1 && parv[1] != NULL && !IsChannelName(parv[1]))
@@ -224,7 +221,7 @@ static int mo_list(struct Client *client_p, struct Client *source_p, int parc, c
  */
 static int safelist_sendq_exceeded(struct Client *client_p)
 {
-       if (linebuf_len(&client_p->localClient->buf_sendq) > (get_sendq(client_p) / 2))
+       if (rb_linebuf_len(&client_p->localClient->buf_sendq) > (get_sendq(client_p) / 2))
                return YES;
        else
                return NO;
@@ -249,7 +246,7 @@ static void safelist_client_instantiate(struct Client *client_p, struct ListClie
        s_assert(MyClient(client_p));
        s_assert(params != NULL);
 
-       self = MyMalloc(sizeof(struct ListClient));
+       self = rb_malloc(sizeof(struct ListClient));
 
        self->hash_indice = 0;
        self->users_min = params->users_min;
@@ -260,7 +257,7 @@ static void safelist_client_instantiate(struct Client *client_p, struct ListClie
        sendto_one(client_p, form_str(RPL_LISTSTART), me.name, client_p->name);
 
        /* pop the client onto the queue for processing */
-       dlinkAddAlloc(client_p, &safelisting_clients);
+       rb_dlinkAddAlloc(client_p, &safelisting_clients);
 
        /* give the user some initial data to work with */
        safelist_iterate_client(client_p);
@@ -283,7 +280,7 @@ static void safelist_client_release(struct Client *client_p)
 
        rb_dlinkFindDestroy(client_p, &safelisting_clients);
 
-       MyFree(client_p->localClient->safelist_data);
+       rb_free(client_p->localClient->safelist_data);
 
        client_p->localClient->safelist_data = NULL;
 
@@ -324,7 +321,7 @@ static void safelist_channel_named(struct Client *source_p, const char *name)
                return;
        }
 
-       if (ShowChannel(source_p, chptr))
+       if (!SecretChannel(chptr) || IsMember(source_p, chptr))
                sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name, chptr->chname,
                           rb_dlink_list_length(&chptr->members),
                           chptr->topic == NULL ? "" : chptr->topic);