hey whats up?
i've wrote a little module for the Anope1.7.13....
the functions i wrote runs... but i want the Service to join a the specified channel (supportchan) when the command "/msg Serv set support on" is used and part the channel on command "/msg Serv set support off".
thanks for ya help
#include "module.h"
#define AUTHOR "black-drag0n"
#define VERSION "1.00"
/* -----------------------------------------------------------
* Name : new_module
* Author: black-drag0n <support@megafumi-source.de>
* Date : 11.05.2006
* -----------------------------------------------------------
* Functions: my_privmsgA, my_nickA, support_check,
* timeout_version_user, CheckOffDefList,
* CheckCustomDefList
* Limitations: None Known.
* Tested: Unreal(3.2)
* -----------------------------------------------------------
* This version has been tested on Unreal.
*
* This modules has 18 configurable options, please read
* The comments
*
*
* Please read the comments by each one.
*
* -----------------------------------------------------------
*/
/* ---------------------------------------------------------------------- */
/* START OF CONFIGURATION BLOCK - please read the comments :) */
/* ---------------------------------------------------------------------- */
#define supportchan "#channel"
#define WOWServHELP1 "%s is a Service for me ;)", s_WowServ
#define WOWServHELP2 "help 2"
#define WOWServHELP3 "help 3"
#define WOWServHELP4 "help 4"
#define WOWServHELP5 "help 5"
#define WOWServHELP6 "Dir Stehen Folgende Befehle zur Auswahl:"
#define WOWServHELP7 "----------------------------------------"
#define WOWServHELP8 "2SYNTAX:2 /msg %s <your supporttext>"
#define WOWServHELP9 "Sendet eine Supportanfrage."
#define WOWServHELP10 "2SYNTAX:2 /msg %s BUG <Bugbeschreibung>"
#define WOWServHELP11 "Sendet einen Neuen Bug ein. Bitte Achtet darauf eine Genaue Beschreibung abzugeben."
#define SUPPORT_ACCEPTED "Deine Supportanfrage wurde Abgesandt."
#define SUPPORT_DISABLED "Die Befehele sind Vorübergehend nich verwendbar"
#define SUPPORT_REJECTED_TOOSMALL "Deine Nachricht ist zu kurz. Bitte vergewisser dich das du MINDESTENS 3 Wörter hast."
char *s_WowServ = "Serv"; /* Nickname - NICKLEN character MAXIMUM */
/* (see your IRCd's protocall responce for this) */
char *s_WowServHOST = "Serv.Service"; /* HostMask: 64 character MAXIMUM */
char *s_WowServREALNAME = "Anope Service"; /* Realname 30 character MAXIMUM */
/* ---------------------------------------------------------------------- */
/* DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING */
/* ---------------------------------------------------------------------- */
int dontsaysupport=3;
int send_wowserv_help(User *u);
void send_wowserv_fhelp(User *u);
int my_privmsgC(char *source, int ac, char **av);
int my_supportserv_killrejoin(char *source, int ac, char **av);
int support_check(User * u, char *buf);
//char supportchan[50];
int AnopeInit(int argc, char **argv)
{
Message *msg = NULL;
int status;
msg = createMessage("NOTICE", my_privmsgC);
status = moduleAddMessage(msg, MOD_HEAD);
msg = createMessage("PRIVMSG", my_privmsgC);
status = moduleAddMessage(msg, MOD_HEAD);
msg = createMessage("KILL", my_supportserv_killrejoin);
status = moduleAddMessage(msg, MOD_HEAD);
if (status == MOD_ERR_OK) {
NEWNICK( s_WowServ, s_WowServ, s_WowServHOST, s_WowServREALNAME, "+oS", 1);
}
moduleAddAuthor(AUTHOR);
moduleAddVersion(VERSION);
alog("[ircd_wowtserv] Modul wurde geladen und ist nun Aktiv.");
alog("[ircd_wowserv] Für mehr Informationen nutze /msg %s HELP", s_WowServ);
#ifdef IRC_HYBRID
send_cmd(NULL, "SJOIN %ld :@%s", time(NULL), s_WowServ);
send_cmd(whosends(ci), "MODE +ovs %s %lu", s_WowServ, time(NULL));
#endif
return MOD_CONT;
}
void AnopeFini(void)
{
send_cmd( s_WowServ, "QUIT :Module Unloaded!");
}
int my_privmsgC(char *source, int ac, char **msg)
{
User *u;
char *s;
if (ac != 2) {
return MOD_CONT;
}
if (!(u = finduser(source))) {
return MOD_CONT;
}
if (*msg[0] == '#') {
return MOD_CONT;
}
/* Channel message */
s = strchr(msg[0], '@');
if (s) {
*s++ = 0;
if (stricmp(s, ServerName) != 0) {
return MOD_CONT;
}
}
if ((stricmp(msg[0], s_WowServ)) == 0) {
support_check(u, msg[1]);
return MOD_CONT;
} else {
}
}
/*****************************************************************************/
int support_check(User * u, char *buf)
{
char *FirstWord;
char *SecondWord;
char *buffer;
FirstWord = strtok(buf," ");
SecondWord = strtok(NULL," ");
buffer = strtok(NULL,"");
if (!is_oper(u)) {
if (dontsaysupport == 1) {
return MOD_CONT;
}
}
if (!FirstWord) {
return MOD_CONT;
}
if (stricmp(FirstWord, "1PING") == 0) {
if (!SecondWord) {
SecondWord = "1";
}
notice(s_WowServ, u->nick, "1PING %s", SecondWord);
return MOD_CONT;
}
if (skeleton) {
notice_lang(s_WowServ, u, SERVICE_OFFLINE, s_WowServ);
return MOD_CONT;
}
if ((stricmp(FirstWord, "HELP") == 0) && (!SecondWord)) {
if (dontsaysupport != 1) {
send_wowserv_help(u);
}
return MOD_CONT;
}
if (!is_oper(u)) {
if (dontsaysupport == 2) {
notice(s_WowServ, u->nick, SUPPORT_DISABLED);
return MOD_CONT;
}
}
if (is_services_admin(u)) {
if (stricmp(FirstWord, "SET") == 0) {
if (!SecondWord) {
notice(s_WowServ, u->nick, "Nutze 2/msg %s HELP2 für weitere Informationen.", s_WowServ);
return MOD_CONT;
}
if (stricmp(SecondWord, "SUPPORT") == 0) {
if (!buffer) {
notice(s_WowServ, u->nick, "Nutze 2/msg %s HELP2 für weitere Informationen.", s_WowServ);
return MOD_CONT;
}
if (stricmp(buffer, "ON") == 0) {
dontsaysupport = 3;
notice( s_WowServ, u->nick, "SupportService wurde Aktiviert");
wallops( s_WowServ, "%s set %s Support ON", u->nick, s_WowServ);
return MOD_CONT;
}
if (stricmp(buffer, "OFF") == 0) {
dontsaysupport = 2;
notice( s_WowServ, u->nick, "SupportService wurde deaktiviert");
wallops( s_WowServ, "%s set %s Support OFF", u->nick, s_WowServ);
return MOD_CONT;
}
if (stricmp(buffer, "SILENT") == 0) {
dontsaysupport = 1;
notice( s_WowServ, u->nick, "Support wurde deaktiviert [SILENT]");
wallops( s_WowServ, "%s set %s Support OFF [SILENT]", u->nick, s_WowServ);
return MOD_CONT;
}
return MOD_CONT;
}
}
}
if (!SecondWord) {
if (dontsaysupport == 2) {
notice(s_WowServ, u->nick, SUPPORT_REJECTED_TOOSMALL);
return MOD_CONT;
}
}
if (!buffer) {
notice(s_WowServ, u->nick, SUPPORT_REJECTED_TOOSMALL);
return MOD_CONT;
}
if (buffer) {
if (dontsaysupport == 3) {
if (stricmp(FirstWord, "BUG") == 0) {
send_cmd(s_WowServ, "PRIVMSG %s New Bug from:[%s!%s@%s] Description: %s %s", supportchan, u->nick, u->username,
u->host, SecondWord, buffer);
notice(s_WowServ, u->nick, SUPPORT_ACCEPTED);
return MOD_CONT;
}
else {
send_cmd(s_WowServ, "PRIVMSG %s Support from:[%s!%s@%s] Description: %s %s %s", supportchan, u->nick, u->username,
u->host, FirstWord, SecondWord, buffer);
notice(s_WowServ, u->nick, SUPPORT_ACCEPTED);
return MOD_CONT;
}
}
}
return MOD_CONT;
}
int send_wowserv_help(User *u)
{
if (is_oper(u)) {
notice( s_WowServ, u->nick, "-----------------------------------------------------------------------");
notice( s_WowServ, u->nick, "%s ist ein Service für den WoW Support.", s_WowServ);
notice( s_WowServ, u->nick, "Services Admins haben zugriff auf folgenede einstellungen -");
notice( s_WowServ, u->nick, "/msg %s SET SUPPORT [on|off|silent]", s_WowServ);
notice( s_WowServ, u->nick, "Bei ON wird %s die Supportanfragen in %s posten.", s_WowServ, supportchan);
notice( s_WowServ, u->nick, "OFF Schaltet den Dienst ab.");
notice( s_WowServ, u->nick, "Bei SILENT wird jeder Nicht-Oper von %s ignoriert.", s_WowServ);
notice( s_WowServ, u->nick, " ");
notice( s_WowServ, u->nick, "Hilfebeschreibung für normale User:");
notice( s_WowServ, u->nick, " ");
send_wowserv_fhelp(u);
return MOD_CONT;
}
send_wowserv_fhelp(u);
return MOD_CONT;
/*}*/
}
void send_wowserv_fhelp(User *u)
{
if (!is_oper(u)) {
notice(s_WowServ, u->nick, "-----------------------------------------------------------------------");
}
#ifdef WOWServHELP1
notice(s_WowServ, u->nick, WOWServHELP1);
#endif
#ifdef WOWServHELP2
notice(s_WowServ, u->nick, WOWServHELP2);
#endif
#ifdef WOWServHELP3
notice(s_WowServ, u->nick, WOWServHELP3);
#endif
#ifdef WOWServHELP4
notice(s_WowServ, u->nick, WOWServHELP4);
#endif
#ifdef WOWServHELP5
notice(s_WowServ, u->nick, WOWServHELP5);
#endif
#ifdef WOWServHELP6
notice(s_WowServ, u->nick, WOWServHELP6);
#endif
#ifdef WOWServHELP7
notice(s_WowServ, u->nick, WOWServHELP7);
#endif
#ifdef WOWServHELP8
notice(s_WowServ, u->nick, WOWServHELP8);
#endif
#ifdef WOWServHELP9
notice(s_WowServ, u->nick, WOWServHELP9);
#endif
#ifdef WOWServHELP10
notice(s_WowServ, u->nick, WOWServHELP10);
#endif
#ifdef WOWServHELP11
notice(s_WowServ, u->nick, WOWServHELP11);
#endif
notice(s_WowServ, u->nick, "-----------------------------------------------------------------------");
return;
}
int my_supportserv_killrejoin(char *source, int ac, char **av)
{
if (ac != 2) {
return MOD_STOP;
}
if (stricmp(av[0], s_WowServ) == 0) {
alog("[ircd_wowserv] %s wurde GEKILLt, Reconnectning.", s_WowServ);
NEWNICK( s_WowServ, s_WowServ, s_WowServHOST, s_WowServREALNAME, "+oS", 1);
return MOD_STOP;
}
return MOD_CONT;
}
The basic scructure is from the ircd_reportserv module...
i hope someone can help me
[Bearbeitet am 11-5-2006 von black-drag0n]
[Bearbeitet am 11-5-2006 von black-drag0n]
[Bearbeitet am 11-5-2006 von black-drag0n]
[Bearbeitet am 11-5-2006 von black-drag0n]
[Bearbeitet am 11-5-2006 von black-drag0n]