Uysal sendraw.c modülü - IRCForumu.ORG
IRCForumu.ORG sohbet  

Sohbet

Geri Git IRCForumu.ORG > Geri Dönüþüm Kutusu > ♦ Arþivlenmiþ Sunucular ♦ > SohbetBeste.Com & RadyoBeste > Uysal sendraw.c modülü
Konu ID: 22436
Seçenekler Stil
Alt 15 Ekim 2021, 23:19   #1
Standart Uysal sendraw.c modülü

Sendraw genelde tüm sunucularýn radyo linki, çalan þarký veya duyuru mesajlarýný kullanýcýlara göndermek için kullandýðý ama bundan daha fazlasýna yarayan bir modül. Sunucuda olmayan birini oradaymýþ gibi konuþturmak, sunucuda olduðu halde çýktý gibi göstermek vb. türü eðlenceli þeyler için de kullanýlýr. Bu modülün birkaç satýr düzenlenmiþ halini paylaþýyorum. Normalde diðer adminler kimin /sendraw komutunu ne için kullandýðýný görür ama bu uysal edit sayesinde kimin kullandýðý görülmeden de uygulanabilir.

Kod
/*
 * =================================================================
 * Filename:       m_sendraw.c
 * Description:	   Command /sendraw
 * Author:         AngryWolf <[email protected]>
 * Author:         Turkce Edit Download WwW.Mirc.Gen.Tr
 * Documentation:  Comes with the package (m_sendraw.txt)
 * =================================================================
 */

#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

extern void		sendto_one(aClient *to, char *pattern, ...);
extern void		sendto_realops(char *pattern, ...);

#define MSG_SENDRAW 	"SENDRAW"
#define TOK_SENDRAW 	"SR"
#define DelCommand(x)	if (x) CommandDel(x); x = NULL

static Command		*AddCommand(Module *module, char *msg, char *token, iFP func);
static int		m_sendraw(aClient *cptr, aClient *sptr, int parc, char *parv[]);

Command			*CmdSendraw;

ModuleHeader MOD_HEADER(m_sendraw)
  = {
	"sendraw",
	"$Id: m_sendraw.c,v 3.1 2004/05/17 20:55:18 angrywolf Exp $",
	"command /sendraw",
	"3.2-b8-1",
	NULL 
    };

DLLFUNC int MOD_INIT(m_sendraw)(ModuleInfo *modinfo)
{
	CmdSendraw = AddCommand(modinfo->handle, MSG_SENDRAW, TOK_SENDRAW, m_sendraw);

	if (!CmdSendraw)
		return MOD_FAILED;

	return MOD_SUCCESS;
}

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

DLLFUNC int MOD_UNLOAD(m_sendraw)(int module_unload)
{
	DelCommand(CmdSendraw);

	return MOD_SUCCESS;
}

static Command *AddCommand(Module *module, char *msg, char *token, iFP func)
{
	Command *cmd;

	if (CommandExists(msg))
    	{
		config_error("Command %s already exists", msg);
		return NULL;
    	}
    	if (CommandExists(token))
	{
		config_error("Token %s already exists", token);
		return NULL;
    	}

	cmd = CommandAdd(module, msg, token, func, MAXPARA, 0);

#ifndef STATIC_LINKING
	if (ModuleGetError(module) != MODERR_NOERROR || !cmd)
#else
	if (!cmd)
#endif
	{
#ifndef STATIC_LINKING
		config_error("Error adding command %s: %s", msg,
			ModuleGetErrorStr(module));
#else
		config_error("Error adding command %s", msg);
#endif
		return NULL;
	}

	return cmd;
}

/*
** m_sendraw
**      parv[0] = sender prefix
**      parv[1] = targets separated by commas (nick/server/channel)
**      parv[2] = message
*/

static int m_sendraw(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	aClient		*acptr;
	aChannel	*chptr;
	char		*recipients, *to, *message, *p;

        if (!MyClient(sptr) || !IsNetAdmin(sptr))
	{
        	sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]);
		return -1;
	}

        if (parc < 3 || BadPtr(parv[2]))
	{
    		sendto_one(sptr, ":%s NOTICE %s :*** Usage: /sendraw <to1>[,<to2>,[,<to3>...]]> [:]<message>",
	                me.name, sptr->name);
    		sendto_one(sptr, ":%s NOTICE %s :*** <to>: <#channel>|<nick>|<server>|-servers",
	                me.name, sptr->name);
    		sendto_one(sptr, ":%s NOTICE %s :*** '-servers' sends a message to all servers connected to the local one",
	                me.name, sptr->name);
    		sendto_one(sptr, ":%s NOTICE %s :*** Example: /sendraw #opers ::Lamer PRIVMSG #opers :Hello!",
	                me.name, sptr->name);
		return -1;
	}

	recipients	= strdup(parv[1]);
	message		= parv[2];

	for (to = strtoken(&p, recipients, ","); to; to = strtoken(&p, NULL, ","))
	{

    		if (!strcasecmp(to, "-servers"))
			sendto_serv_butone(&me, message);
    		else if (*to == '#' && (chptr = find_channel(to, NullChn)) != NullChn)
			sendto_channel_butone(&me, &me, chptr, message);
    		else if ((acptr = find_person(to, NULL)) || (acptr = find_server_quick(to)))
			sendto_one(acptr, message);
		else
		{
			if (!IsServer(sptr))
	    			sendto_one(sptr, err_str(ERR_NOSUCHNICK),
					me.name, sptr->name, to);
			return -1;
		}

	}

	MyFree(recipients);
	
	return 0;

}

Alýntý falan deðildir.

 
 

Etiketler
modülü, sendraw.c, uysal


Þu anda bu konuyu görüntüleyen etkin kullanýcýlar: 1 (0 üye ve 1 ziyaretçi)
 
Seçenekler
Stil

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajýnýzý Deðiþtirme Yetkiniz Yok

BB kodu Açýk
Smileler Açýk
[IMG] Kodlarý Açýk
HTML-Kodu Kapalý
Trackbacks are Açýk
Pingbacks are Açýk
Refbacks are Kapalý


Tüm Zamanlar GMT +3 Olarak Ayarlanmýþ. Þuanki Zaman: 13:51.