Page 1 of 1

Rejecting nonOpers to join any unregistered Channel

Posted: Sat Mar 25, 2006 9:37 pm
by Fussi
Yeah, thats what i want to do via module. Pretty simple stuff, around 3 lines of code. Well, i thought that.. But somehow, it isnt loading oO
Dont think its the source, i took m_dummy.c and added my 3 lines.
No compile errors, but when i try to start unreal, i get this:

Code: Select all

* Loading IRCd configuration ..
* /home/irc/v3/testserver/unrealircd.conf:44: loadmodule src/modules/m_nounreg.so: failed to load: tmp/9DBC590A.m_nounreg.so: cannot open shared object file: No such file or directory
m_nounreg.so is compiled and in src/modules folder...
Any idea?


Oh btw, here's the module if you're interested. Maybe i did something wrong?

Code: Select all

/*
 * Author: Stefan 'Fussi' Thomanek
 * Version: 1.0.0.0
 * Description: Only let IRCOps join all channels.
 * Non-Opers only may join registered (+r) channels
 */
#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "channel.h"
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <io.h>
#endif
#include <fcntl.h>
#include "h.h"
#ifdef STRIPBADWORDS
#include "badwords.h"
#endif
#ifdef _WIN32
#include "version.h"
#endif

#define MyMod		Modnounreg->handle

DLLFUNC int m_nounreg(aClient *cptr, aClient *sptr, int parc, char *parv[]);

/* Place includes here */
//#define MSG_DUMMY 	"nounreg"	/* dummy */
//#define TOK_DUMMY 	"DU"	/* 127 4ever !;) */
static ModuleInfo	*Modnounreg;
static Hook		*HookPreJoin;
static int cb_prejoin(aClient *sptr, aChannel *chptr, char *parv[]);

ModuleHeader MOD_HEADER(m_nounreg)
  = {
	"nounreg",	/* Name of module */
	"$Id: m_nounreg.c,v 1.0.0.0 2006/03/25 21:03:17 Fussi Exp $", /* Version */
	"Reject the userjoin of nonregistered Channel", /* Short description of module */
	"3.2-b8-1",
	NULL
    };

/* This is called on module init, before Server Ready */
DLLFUNC int MOD_INIT(m_nounreg)(ModuleInfo *modinfo)
{
    Modnounreg = modinfo;

	return MOD_SUCCESS;
}

DLLFUNC int MOD_TEST(m_nounreg)(ModuleInfo *modinfo)
{
	Modnounreg = modinfo;

	return MOD_SUCCESS;
}

/* Is first run when server is 100% ready */
DLLFUNC int MOD_LOAD(m_nounreg)(int module_load)
{
    HookAddEx(MyMod, HOOKTYPE_PRE_LOCAL_JOIN, cb_prejoin);
	return MOD_SUCCESS;
}


/* Called when module is unloaded */
DLLFUNC int MOD_UNLOAD(m_nounreg)(int module_unload)
{
    DelHook(HookPreJoin);
	return MOD_SUCCESS;
}

static int cb_prejoin(aClient *sptr, aChannel *chptr, char *parv[])
{
    if ((chptr->mode.mode & MODE_RGSTR) || IsAnOper(sptr) || IsSkoAdmin(sptr) || IsCoAdmin(sptr) || IsNetAdmin(sptr) || IsSAdmin(sptr))
    {
        return 1;
    }
    return 0;
}


Posted: Sat Mar 25, 2006 9:59 pm
by Stealth
This would probably be better done by services...

Posted: Sat Mar 25, 2006 10:33 pm
by Fussi
I totaly agree. IF the services provide such a function.
And Anope doesnt. There's a module for 1.7.13 but well, read here:
http://forum.anope.org/viewthread.php?tid=199

Posted: Sun Mar 26, 2006 9:14 pm
by w00t
If it's compiled fine, then you've probably got a permissions problem somewhere.