IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   Unreal IRCd (https://www.ircforumlari.net/unreal-ircd/)
-   -   ircops module edit (https://www.ircforumlari.net/unreal-ircd/53500-ircops-module-edit.html)

RedLine 11 Nisan 2008 20:28

ircops module edit
 
Kod:

/*
 * =================================================================
 * Filename:          m_ircops.c
 * Description:      Command /ircops.
 * Author:            AngryWolf <
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
>
 * Documentation:    m_ircops.txt (comes with the package)
 * =================================================================
 */

#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

typedef struct
{
    long *umode;
    char *text;
} oflag;


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

/*
 * Ultimate uses numerics 386 and 387 for RPL_IRCOPS and RPL_ENDOFIRCOPS,
 * but these numerics are RPL_QLIST and RPL_ENDOFQLIST in UnrealIRCd
 * (numeric conflict). I had to choose other numerics.
 */

#define RPL_IRCOPS        337
#define RPL_ENDOFIRCOPS        338
#define MSG_IRCOPS        "IRCOPS"
#define TOK_IRCOPS        NULL
#define IsAway(x)        (x)->user->away
#define IsSkoAdmin(sptr)    (IsAdmin(sptr) || IsNetAdmin(sptr) || IsSAdmin(sptr) || IsCoAdmin(sptr))
#define DelCommand(x)        if (x) CommandDel(x); x = NULL

static int            m_ircops(aClient *cptr, aClient *sptr, int parc, char *parv[]);

static Command            *CmdIrcops;
static oflag            otypes[7];

ModuleHeader MOD_HEADER(m_ircops)
  = {
    "ircops",
    "$Id: m_ircops.c,v 3.2 2004/07/11 23:39:48 angrywolf Exp $",
    "command /ircops",
    "3.2-b8-1",
    NULL
    };


DLLFUNC int MOD_INIT(m_ircops)(ModuleInfo *modinfo)
{
    otypes[0].umode = &UMODE_NETADMIN;
    otypes[0].text = "        Network Administrator";
    otypes[1].umode = &UMODE_SADMIN;
    otypes[1].text = "        Services Administrator";
    otypes[2].umode = &UMODE_ADMIN;
    otypes[2].text = "        Server Administrator";
    otypes[3].umode = &UMODE_COADMIN;
    otypes[3].text = "        Co Administrator";
    otypes[4].umode = &UMODE_OPER;
    otypes[4].text = "        IRC Operator";
    otypes[5].umode = &UMODE_LOCOP;
    otypes[5].text = "        Local Operator";
    otypes[6].umode = NULL;
    otypes[6].text = NULL;

        if (CommandExists(MSG_IRCOPS))
        {
                config_error("Command " MSG_IRCOPS " already exists");
                return MOD_FAILED;
        }

        CmdIrcops = CommandAdd(modinfo->handle, MSG_IRCOPS, TOK_IRCOPS,
        m_ircops, MAXPARA, 0);

#ifndef STATIC_LINKING
        if (ModuleGetError(modinfo->handle) != MODERR_NOERROR)
#else
        if (!CmdIrcops)
#endif
        {
#ifndef STATIC_LINKING
                config_error("Error adding command " MSG_IRCOPS ": %s",
                        ModuleGetErrorStr(modinfo->handle));
#else
                config_error("Error adding command " MSG_IRCOPS);
#endif
                return MOD_FAILED;
        }

    return MOD_SUCCESS;
}

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


DLLFUNC int MOD_UNLOAD(m_ircops)(int module_unload)
{
    DelCommand(CmdIrcops);
    return MOD_SUCCESS;
}


static char *find_otype(long umodes)
{
    unsigned int i;
   
    for (i = 0; otypes[i].umode; i++)
        if (*otypes[i].umode & umodes)
            return otypes[i].text;

    return "an unknown operator";
}

/*
 * m_ircops
 *
 *    parv[0]: sender prefix
 *
 *    Originally comes from TR-IRCD, but I changed it in several places.
 *    In addition, I didn't like to display network name. In addition,
 *    instead of realname, servername is shown. See the original
 *    header below.
 */

/************************************************************************
 * IRC - Internet Relay Chat, modules/m_ircops.c
 *
 *  Copyright (C) 2000-2002 TR-IRCD Development
 *
 *  Copyright (C) 1990 Jarkko Oikarinen and
 *                      University of Oulu, Co Center
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

static int m_ircops(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
    aClient        *acptr;
    char        buf[BUFSIZE];
    int        opers = 0, admins = 0, globs = 0, aways = 0;
    for (acptr = client; acptr; acptr = acptr->next)
    {
        /* List only real IRC Operators */
        if (IsULine(acptr) || !IsPerson(acptr) || !IsAnOper(acptr))
            continue;
        /* Don't list +H users */
        if (!IsAnOper(sptr) && IsHideOper(acptr))
            continue;

        sendto_one(sptr, ":%s %d %s :\2%s\2 %s  \2%s\2" "%s",
            me.name, RPL_IRCOPS, sptr->name,
            acptr->name,
            find_otype(acptr->umodes),
            acptr->user->server,
            (IsAway(acptr) ? " [Meşgul]" : IsHelpOp(acptr) ? " " : ""));

        if (IsAway(acptr))
            aways++;
        else if (IsSkoAdmin(acptr))
            admins++;
        else
            opers++;

    }

    globs = opers + admins + aways;

    sprintf(buf,
        "Total: \2%d\2 Operatör%s Bağlı - \2%d\2 tanesi Admin%s, \2%d\2 tanesi Oper%s ve \2%d\2 tanesi Meşgul",
        globs, (globs) > 1 ? " " : "", admins, admins > 1 ? " " : "",
        opers, opers > 1 ? " " : "", aways);

    sendto_one(sptr, ":%s %d %s :%s", me.name, RPL_IRCOPS, sptr->name, buf);
    sendto_one(sptr, ":%s %d %s :(/IRCOPS) listesi sonu.", me.name, RPL_ENDOFIRCOPS, sptr->name);
sendto_realops("%s /ircops komutunu kullandı.", sptr->name);

    return 0;
}

Arkadaşlar burdaki
Kod:

sendto_realops("%s /ircops komutunu kullandı.", sptr->name);
bölümünü ben ekledim ve operlere notice olarak geliyor fakat sunucuda hub var diğer hubdan bağlı operlere gitmiyor. Bu notice'in tüm hublardaki operlere gitmesi için ne yapabiliriz?
Bilgisi olan yardımcı olursa şimdiden çok tşk ederim.

Taner 09 Mayıs 2009 20:08

Cevap: ircops module edit
 
/ircops komutunu notice olarak nasıl gösterebilirim.Denedim ama bir türlü yapamadım.Yeni konu açmak yerine bu başlık altında sormak istedim

Sky-Dancer 09 Mayıs 2009 21:05

Cevap: ircops module edit
 
Alıntı:

temonde Nickli Üyeden Alıntı (Mesaj 707436)
/ircops komutunu notice olarak nasıl gösterebilirim.Denedim ama bir türlü yapamadım.Yeni konu açmak yerine bu başlık altında sormak istedim

sendto_one(sptr, ":%s %d %s :\2%s\2 %s \2%s\2" "%s",
me.name, RPL_IRCOPS, sptr->name,
acptr->name,
find_otype(acptr->umodes),
acptr->user->server,
(IsAway(acptr) ? " [Meşgul]" : IsHelpOp(acptr) ? " " : ""));

bu satırları şununla değiştirin:

sendto_one(sptr, ":%s NOTICE %s :\2%s\2 %s \2%s\2" "%s",
me.name, sptr->name,
acptr->name,
find_otype(acptr->umodes),
acptr->user->server,
(IsAway(acptr) ? " [Meşgul]" : IsHelpOp(acptr) ? " " : ""));

---------------

sendto_one(sptr, ":%s %d %s :%s", me.name, RPL_IRCOPS, sptr->name, buf);
sendto_one(sptr, ":%s %d %s :(/IRCOPS) listesi sonu.", me.name, RPL_ENDOFIRCOPS, sptr->name);

yukarıdaki satırları şununla değiştirin:

sendto_one(sptr, ":%s NOTICE %s :%s", me.name, sptr->name, buf);
sendto_one(sptr, ":%s NOTICE %s :(/IRCOPS) listesi sonu.", me.name, sptr->name);




ama ne kadar güzel görünür orasını bilemem :S

iyi çalışmalar..

Sky-Dancer 09 Mayıs 2009 21:16

Cevap: ircops module edit
 
Alıntı:

RedLίne Nickli Üyeden Alıntı (Mesaj 369455)
Arkadaşlar burdaki
Kod:

sendto_realops("%s /ircops komutunu kullandı.", sptr->name);
bölümünü ben ekledim ve operlere notice olarak geliyor fakat sunucuda hub var diğer hubdan bağlı operlere gitmiyor. Bu notice'in tüm hublardaki operlere gitmesi için ne yapabiliriz?
Bilgisi olan yardımcı olursa şimdiden çok tşk ederim.

denemedim ama şu şekilde belki yapabilirsiniz:

yukarıdaki tek satır yerine aşağıdaki satırları yazıp deneyin bi:

aClient *xcptr;
for (xcptr = client; xcptr; xcptr = xcptr->next) {
if (IsServer(xcptr))
continue;
if (IsULine(xcptr))
continue;
// bu mesajın kendimize gelmemesi için.
if (xcptr == sptr)
continue;
if (IsOper(xcptr))
sendto_one(xcptr, ":%s NOTICE %s :%s", me.name, xcptr->name, sptr->name);
}

yanlış hatırlamıyorsam, linklenme ve giriş çıkışlar esnasında tüm nickler hafızaya kopyalanıyordu, ama extra bilgileri diğer ircd ye bağlıydı. veya benzer durum vardı. Yukarıdaki kodun çalışması lazım. deneyip sonucu söylersiniz sevinirim.

iyi çalışmalar..

Sky-Dancer 09 Mayıs 2009 21:20

Cevap: ircops module edit
 
Alıntı:

Sky-Dancer Nickli Üyeden Alıntı (Mesaj 707476)
denemedim ama şu şekilde belki yapabilirsiniz:

yukarıdaki tek satır yerine aşağıdaki satırları yazıp deneyin bi:

aClient *xcptr;
for (xcptr = client; xcptr; xcptr = xcptr->next) {
if (IsServer(xcptr))
continue;
if (IsULine(xcptr))
continue;
// bu mesajın kendimize gelmemesi için.
if (xcptr == sptr)
continue;
if (IsOper(xcptr))
sendto_one(xcptr, ":%s NOTICE %s :%s", me.name, xcptr->name, sptr->name);
}

yanlış hatırlamıyorsam, linklenme ve giriş çıkışlar esnasında tüm nickler hafızaya kopyalanıyordu, ama extra bilgileri diğer ircd ye bağlıydı. veya benzer durum vardı. Yukarıdaki kodun çalışması lazım. deneyip sonucu söylersiniz sevinirim.

iyi çalışmalar..

bu da olmazsa, linkler arası bir bilgilendirme modülü yazılıp, her linke konulup, ircd ler arası notice verisi gönderilebilir. Ama yine de yukarıdaki kodun çalışması lazım :)

iyi çalışmalar..

Taner 09 Mayıs 2009 21:38

Cevap: ircops module edit
 
#define IsSkoAdmin(sptr) (IsAdmin(sptr) || IsNetAdmin(sptr) || IsSAdmin(sptr) || IsCoAdmin(sptr))

Bu satırda make'te hata alıyorum

Sky-Dancer 09 Mayıs 2009 21:42

Cevap: ircops module edit
 
Alıntı:

temonde Nickli Üyeden Alıntı (Mesaj 707508)
#define IsSkoAdmin(sptr) (IsAdmin(sptr) || IsNetAdmin(sptr) || IsSAdmin(sptr) || IsCoAdmin(sptr))

Bu satırda make'te hata alıyorum


aldığınız hata nedir?

redefinition diyor ise, o sayırı silip tekrar make çekin modüle (unreal 3.2.3 den sonrasında herhalde o satır kütüphane dosyalarından birinde tanımlanmıştı, yanlış hatırlamıyorsam.)

iyi çalışmalar..

Taner 10 Mayıs 2009 04:41

Cevap: ircops module edit
 
Sky-Dancer yardımların için teşekkür ederim.
Son bir sorum daha olacaktı./ircops komutunda belirlediğim nicklerin gözükmemesini istiyorum.Bunuda yapmama yardımcı olursanız çok teşekkür edicem size.
İyi forumlar

toXic 10 Mayıs 2009 11:51

Cevap: ircops module edit
 
+H Modunu Almıs Nickler, Oper Girmiş Gözükmezler ve Dahilinde /ircops Komutunda Cıkmazlar. Bu Mode'yi Göstermek istemediklerine verirsen Bu Komutta Gözükmeyeceklerdir.

Sky-Dancer 10 Mayıs 2009 12:21

Cevap: ircops module edit
 
Alıntı:

temonde Nickli Üyeden Alıntı (Mesaj 707807)
Sky-Dancer yardımların için teşekkür ederim.
Son bir sorum daha olacaktı./ircops komutunda belirlediğim nicklerin gözükmemesini istiyorum.Bunuda yapmama yardımcı olursanız çok teşekkür edicem size.
İyi forumlar

RandomQuit veya RandomJoin modüllerimdeki gibi, basit bir mantık ile, tam olarak şöyle bişey yapılabilir:

/* Don't list +H users */

yukarıdaki açıklama satırının hemen bir üstüne şu satırları ekleyin:
char *NickListesi[] = {
"Nick1",
"Nick2",
"Nick3"
};
int nickboyutu = (sizeof(NickListesi)/sizeof(*NickListesi));
for (int i=0; i<nickboyutu; i++)
if (!stricmp(acptr->name, NickListesi[i]))
continue;


denemedim ama çalışması gerekir.

Not1:
NickListesi adlı dizide son elemandan sonraki tırnakta , kullanmayınız
[yukarıdaki gibi kullanınız].

Not2:
Dizi içindeki elemanlara ekleme ve çıkartma
...
"..",
"..",
"..",
".."}; gibisinden yapılabilir.

Not3:
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] arkadaşımızın dediği gibi +H modu ile de yapılabilir. Ama +H almış nicklerin whoisleri oper durumunda görünmediği için, arkadaşımızın tam istediği şey, bu verdiğim kod olması lazım.

iyi Çalışmalar..


Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 03:25.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2025 IRCForumlari.Net Sparhawk