10 Şubat 2015, 22:30 | #1 |
Üyelik tarihi: 25 Ocak 2015
Mesajlar: 109 WEB Sitesi: * IRC Sunucusu: * İlgi Alanı: Alınan Beğeni: 14 |
IRCServices çoklu root eklentisi..
Bir zamanlar çok istenen bir özellik..
16.06.2007 tarihinde yapmıştım, ve yayınlamaya karar verdim. kodlama : orta~zor ekleme (edit) : kolay~orta tek dosya içerisinde işlem yapıyoruz: Aşama #0: cd ircservices-xxx cd modules cd operserv pico main.c Aşama #1: Kod:
char * ServicesRoot; Kod:
char **Sky_Roots_Char; static int Sky_Roots_Int; static int Sky_Realod=0; Kod:
static int introduce_operserv(const char *nick) Kod:
void Root_Ayir(char *ServicesRoot_); void Root_Ayir(char *ServicesRoot_) { char *Sky_Temp=NULL; Sky_Realod=1; if (ServicesRoot_) { Sky_Roots_Int = 0; Sky_Temp = strtok(ServicesRoot_, " "); do { if (Sky_Temp) { Sky_Roots_Int++; Sky_Roots_Char = realloc(Sky_Roots_Char, sizeof(char *) * Sky_Roots_Int); Sky_Roots_Char[Sky_Roots_Int - 1] = sstrdup(Sky_Temp); } } while ((Sky_Temp = strtok(NULL, " "))); } if (!Sky_Roots_Int) config_error("operserv/main", 0, "No Root NickName(s) Defined"); } Kod:
int is_services_root(User *u) { NickInfo *ni; int rootid; static int warned_ni = 0, warned_id = 0; if (u->flags & UF_SERVROOT) return 1; if (!(ni = get_nickinfo(ServicesRoot))) { if (!warned_ni) { wallops(s_OperServ, "Warning: Services super-user nickname %s" " is not registered", ServicesRoot); warned_ni = 1; } module_log("warning: ServicesRoot nickname not registered"); return 0; } warned_ni = 0; if (!(rootid = ni->nickgroup)) { if (!warned_id) { wallops(s_OperServ, "Warning: Services super-user nickname %s" " is forbidden or not properly registered", ServicesRoot); warned_id = 1; } module_log("warning: ServicesRoot nickname forbidden or registered" " data corrupt"); return 0; } if (!is_oper(u) || !u->ni || u->ni->nickgroup != rootid) return 0; if (user_identified(u)) return 1; return 0; } Kod:
int is_services_root(User *u) { int i; int ret=0; NickInfo *ni; int rootid; static int warned_ni = 0, warned_id = 0; if (u->flags & UF_SERVROOT) return 1; for (i = 0; i < Sky_Roots_Int; i++) { if (!(ni = get_nickinfo(Sky_Roots_Char[i]))) { // if (!warned_ni) { wallops(s_OperServ, "Warning: Services super-user nickname %s" " is not registered", Sky_Roots_Char[i]); warned_ni = 1; // } module_log("warning: ServicesRoot nickname not registered"); continue; } // warned_ni = 0; if (!(rootid = ni->nickgroup)) { // if (!warned_id) { wallops(s_OperServ, "Warning: Services super-user nickname %s" " is forbidden or not properly registered", Sky_Roots_Char[i]); // warned_id = 1; // } module_log("warning: ServicesRoot nickname forbidden or registered" " data corrupt"); continue; } } for (i = 0; i < Sky_Roots_Int; i++) { if (!(ni = get_nickinfo(Sky_Roots_Char[i]))) continue; if (!(rootid = ni->nickgroup)) continue; if (!is_oper(u) || !u->ni || u->ni->nickgroup != rootid) { ret=0; } else { ret=1; break; } } if (ret && user_identified(u)) return 1; return 0; } Kod:
int nick_is_services_admin(NickInfo *ni) { NickGroupInfo *ngi; if (!ni || !(ngi = get_ngi(ni))) return 0; if (stricmp(ni->nick, ServicesRoot) == 0) return 1; return ngi->os_priv >= NP_SERVADMIN; } Kod:
int nick_is_services_admin(NickInfo *ni) { int i; NickGroupInfo *ngi; if (!ni || !(ngi = get_ngi(ni))) return 0; for (i = 0; i < Sky_Roots_Int; i++) if (stricmp(ni->nick, Sky_Roots_Char[i]) == 0) return 1; //if (stricmp(ni->nick, ServicesRoot) == 0) //return 1; return ngi->os_priv >= NP_SERVADMIN; } Kod:
old_clearchan_sender_set = 1; Kod:
if (Sky_Realod==0) Root_Ayir(ServicesRoot); kodlar biraz karışık. Bu yüzden anlayamayabilirsiniz nerde ne yapıldığını.. ama kısaca özetlemek gerekir ise; Root satırından gelen nick verisini, aradaki boşluklara göre ayırıp, array'e aktarıp, is_service_root vs. kısmında bu arraydeki nicklerin varlığı||yokluğu şeklinde bakıyoruz.. Varsa root diyoruz. Yok ise root değil diyoruz moduels.conf unuzdaki Root satırınıza bilgi girerken; ServicesRoot Nick1 Nick2 yukarıdaki şekilde DEĞİL; ServicesRoot "Nick1 Nick2" şeklinde girmeniz gerekiyor.. Kod yazarı: Sky-Dancer |
Alıntı
|
Etiketler |
çoklu, eklentisi, ircservices, root |
Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir) | |
Seçenekler | |
Stil | |
|
|
Benzer Konular | ||||
Konu | Konuyu Başlatan | Forum | Cevaplar | Son Mesaj |
ROOT Admin Rütbesi Oluşturma.. | Entrance | Unreal - Parça Kodlar | 8 | 23 Kasım 2018 17:18 |
UnrealIRCd-4.0.4'de ROOT ADMIN rütbesi.. | Entrance | Unreal - 4 Parça Kodlar | 2 | 04 Temmuz 2016 13:10 |
vBulletin - Çoklu(Multi) Üyelik Dedektörü | Anti | vBulletin 3.x.x | 0 | 07 Ağustos 2015 23:22 |
Root'a Ruby Kurulumu! | Entrance | GNU - Linux - UNIX | 1 | 13 Mart 2015 15:39 |
Wp Çoklu Haber Botu | Code | WP Eklentileri | 2 | 03 Mart 2015 17:07 |