Page 1 of 1

Adding a usermode

Posted: Sun Feb 04, 2007 6:18 pm
by Psadi
I'm trying to add a usermode that will for me works roughly like the usermode r. I have looked at some modules that sets up usermodes and I have got it working so fat that the usermodes works in unreal. What im unable to achieve is so that only services can set it. From my understanding reading the API
allowed - A function used to determine if the user may set the usermode. A return value of 0 = can not set, 1 = can set.
allows me to decide if a user should be able to set this them self or not. I have tried to set this to NULL and 0 but Im still able to set it as a user by /mode nick +mode.

I worked from the template that is given in the source and looking on other modules. If you can give me a hint.

Code: Select all

ModuleHeader MOD_HEADER(m_psammode)
  = {
	"m_psammode",
	"$Id: m_psammode.c,v 1.1.2.7.2.1 2007/02/03 00:38:31 Psadi Exp $",
	"Psam user mode to be set by Psam service", 
	"3.2-b8-1",
	NULL 
    };

long UMODE_PSAM = 0L;

DLLFUNC int MOD_INIT(m_psammode)(ModuleInfo *modinfo)
{
	UmodeAdd(modinfo->handle, 'k', UMODE_GLOBAL, 0, &UMODE_PSAM);
	return MOD_SUCCESS;
}

DLLFUNC int MOD_LOAD(m_psammode)(int module_load)
{
	return MOD_SUCCESS;
}

DLLFUNC int MOD_UNLOAD(m_psammode)(int module_unload)
{
	return MOD_SUCCESS;
}

As a follow up question related to this but not a module question.
Im trying to make a service that will use this usermode. It will be set when a user logins to the service. Though when my service sends
:servicenick SVSMODE targetnick +k
it will set the mode to the user but the user will not see that it has received the mode. I tried with SVS2MODE also but same result. I do not negotiate any protocol yet with the server at service join.

Does anybody have any idea?

Thanks for all help in advance.

Posted: Mon Feb 05, 2007 5:30 pm
by Jason
Sent from a ulined server, SVSMODE is a hidden usermode change (and can do some wierd channel stuff) and SVS2MODE is a visible usermode change.

Either your client ate the message, or you aren't ulined, but SVS2MODE should show the mode change to the user.

Posted: Mon Feb 05, 2007 8:34 pm
by Psadi
I think I made an error while I tested it :) when I tested SVS2MODE I think I had the mode set thus it didnt set it to the client. When I tested it now it worked. Thanks Jason.

Though I still can't figure out how in the module can decide if the user should be able to set the mode or not. From the API docs I think I should be able to but I dont get ti to work. So there I still needs help :)