#include <udp.h>#include <wizlevels.h>#include <magier.h>#include <player.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | NEED_PROTOTYPES |
Funktionen | |
| mixed * | _query_localcmds () |
| static int | _udpq (string str) |
| static int | shut_down_game (string str) |
| static int | shut_down_game_2 (string arg, string str) |
| static int | _addmaster (string str) |
| static int | _removemaster (string str) |
| static int | _addguildmaster (string str) |
| static int | _removeguildmaster (string str) |
| static int | sinners (string arg) |
| static int | banish (string str) |
| static int | mbanish (string str) |
| static int | tbanish (string str) |
| static int | sbanish (string str) |
Variablen | |
| inherit std util | cidr |
| static int _addguildmaster | ( | string | str | ) | [static] |
Definiert in Zeile 118 der Datei admin.c.
Benutzt _notify_fail(), add_guild_master(), GOD_SECURITY, guild und master.
00119 { 00120 string master, guild; 00121 00122 if (!GOD_SECURITY) 00123 { 00124 write ("Das darfst Du nicht!\n"); 00125 return 1; 00126 } 00127 00128 _notify_fail("Synatx: addguildmaster <user> <guild>\n"); 00129 if (!str) return 0; 00130 if (sscanf(str, "%s %s", master, guild)!=2) return 0; 00131 if (!master || !guild) return 0; 00132 if (!"/secure/master"->add_guild_master(master,guild)) 00133 write("Hat nicht funktioniert.\n"); 00134 else 00135 write ("Ok.\n"); 00136 return 1; 00137 }

| static int _addmaster | ( | string | str | ) | [static] |
Definiert in Zeile 78 der Datei admin.c.
Benutzt _notify_fail(), add_domain_master(), domain, GOD_SECURITY und master.
00079 { 00080 string master, domain; 00081 00082 if (!GOD_SECURITY) 00083 { 00084 write("Das darfst Du nicht!\n"); 00085 return 1; 00086 } 00087 _notify_fail("Syntax: addmaster <user> <domain>\n"); 00088 if (!str) return 0; 00089 if (sscanf(str,"%s %s",master,domain)!=2) return 0; 00090 if (!master || !domain) return 0; 00091 if (!"/secure/master"->add_domain_master(master,domain)) 00092 write("Hat nicht funktioniert.\n"); 00093 else 00094 write("Ok.\n"); 00095 return 1; 00096 }

| mixed* _query_localcmds | ( | ) |
Definiert in Zeile 20 der Datei admin.c.
Benutzt ARCH_LVL, GOD_LVL, LEARNER_LVL und WIZARD_LVL.
00021 { 00022 return ({({"udpq","_udpq",0,LEARNER_LVL}), 00023 ({"shutdown","shut_down_game",0,ARCH_LVL}), 00024 ({"addmaster","_addmaster",0,GOD_LVL}), 00025 ({"removemaster","_removemaster",0,GOD_LVL}), 00026 ({"addguildmaster", "_addguildmaster", 0, GOD_LVL}), 00027 ({"removeguildmaster", "_removeguildmaster", 0, GOD_LVL}), 00028 ({"suender","sinners",0,WIZARD_LVL}), 00029 ({"banish","banish", 0, WIZARD_LVL}), 00030 ({"mbanish","mbanish", 0, WIZARD_LVL}), 00031 ({"tbanish","tbanish", 0, WIZARD_LVL}), 00032 ({"sbanish","sbanish", 0, WIZARD_LVL})}); 00033 }
| static int _removeguildmaster | ( | string | str | ) | [static] |
Definiert in Zeile 139 der Datei admin.c.
Benutzt _notify_fail(), GOD_SECURITY, guild, master und remove_guild_master().
00140 { 00141 string master, guild; 00142 00143 if (!GOD_SECURITY) 00144 { 00145 write ("Das darfst Du nicht!\n"); 00146 return 1; 00147 } 00148 _notify_fail("Syntax: removeguildmaster <user> <guild>\n"); 00149 if (!str) return 0; 00150 if (sscanf(str, "%s %s", master, guild)!=2) return 0; 00151 if (!master || !guild) return 0; 00152 if (!"/secure/master"->remove_guild_master(master,guild)) 00153 write("Hat nicht funktioniert.\n"); 00154 else 00155 write("Ok.\n"); 00156 return 1; 00157 }

| static int _removemaster | ( | string | str | ) | [static] |
Definiert in Zeile 98 der Datei admin.c.
Benutzt _notify_fail(), domain, GOD_SECURITY, master und remove_domain_master().
00099 { 00100 string master, domain; 00101 00102 if (!GOD_SECURITY) 00103 { 00104 write("Das darfst Du nicht!\n"); 00105 return 1; 00106 } 00107 _notify_fail("Syntax: removemaster <user> <domain>\n"); 00108 if (!str) return 0; 00109 if (sscanf(str,"%s %s",master,domain)!=2) return 0; 00110 if (!master || !domain) return 0; 00111 if (!"/secure/master"->remove_domain_master(master,domain)) 00112 write("Hat nicht funktioniert.\n"); 00113 else 00114 write("Ok.\n"); 00115 return 1; 00116 }

| static int _udpq | ( | string | str | ) | [static] |
Definiert in Zeile 35 der Datei admin.c.
Benutzt _unparsed_args(), DATA, INETD, QUERY, REQUEST und SENDER.
00036 { 00037 string ret, mud, type; 00038 00039 if (!(str=_unparsed_args()) || str=="" || sscanf(str,"%s %s",mud,type)<2) 00040 { 00041 write("Syntax: udpq mud type\n"); 00042 return 1; 00043 } 00044 if (member(({"commands","email","hosts","inetd","list","mud_port","time", 00045 "version"}),type)==-1) 00046 write("TYPEs: commands, email, hosts, inetd, list, mud_port, time, version\n"); 00047 if (ret=(string)INETD->_send_udp(mud,([SENDER:getuid(), REQUEST:QUERY, DATA:type]),1)) 00048 write(ret); 00049 else 00050 write("Anfrage abgeschickt.\n"); 00051 return 1; 00052 }

| static int banish | ( | string | str | ) | [static] |
Definiert in Zeile 224 der Datei admin.c.
Benutzt _unparsed_args(), IS_DEPUTY, LORD_SECURITY, name und secure_euid().
00225 { 00226 string grund, name; 00227 int force; 00228 00229 if ( !LORD_SECURITY && !IS_DEPUTY(secure_euid()) ) 00230 return 0; 00231 00232 if ( !str || !stringp(str) || !strlen(str) ) { 00233 write("Syntax: banish [-f] <name> [<grund>]\n"); 00234 return 1; 00235 } 00236 00237 str = _unparsed_args(); 00238 00239 if ( explode(str, " ")[0] == "-f" ){ 00240 str = implode( explode(str, " ")[1..], " " ); 00241 force = 1; 00242 } 00243 00244 if ( sscanf( str, "%s %s", name, grund ) != 2 ) 00245 name=str; 00246 00247 if ( !name || !strlen(name) ){ 00248 write("Syntax: banish [-f] <name> [<grund>]\n"); 00249 return 1; 00250 } 00251 00252 name=lower_case(name); 00253 "/secure/master"->BanishName( name, grund, force ); 00254 return 1; 00255 }

| static int mbanish | ( | string | str | ) | [static] |
Definiert in Zeile 257 der Datei admin.c.
Benutzt _notify_fail(), ARCH_SECURITY, break_string(), i, IS_DEPUTY, list, MBanishList(), More(), name und secure_euid().
00258 { 00259 string grund, name, *namen, txt, *dummy; 00260 mapping list; 00261 int i; 00262 00263 if ( !IS_DEPUTY(secure_euid()) ) 00264 return 0; 00265 00266 _notify_fail( "Syntax: mbanish <name> [<grund>]\n" ); 00267 00268 if ( !str || !stringp(str) || !strlen(str) ){ 00269 if ( !mappingp(list = (mapping)"/secure/merlin"->MBanishList()) || 00270 !(i = sizeof(list)) ){ 00271 write( "Momentan ist kein Spieler auf der mbanish-Liste.\n" ); 00272 return 1; 00273 } 00274 00275 txt = " Name | gebanisht von | Grund\n" + 00276 "=============================================================" + 00277 "==================\n"; 00278 00279 namen = sort_array( m_indices(list), #'</*'*/ ); 00280 00281 for ( ; i--; ){ 00282 dummy = explode( break_string( list[namen[i],0] || 00283 "-- keine Begruendung --", 45 ), 00284 "\n" ) - ({""}); 00285 00286 txt += sprintf( " %-11s | %-11s | %s\n", 00287 capitalize( namen[i] ), 00288 capitalize( list[namen[i],1] || "" ), 00289 capitalize( implode( dummy, "\n |" 00290 " | " ) ) ); 00291 } 00292 00293 More(txt); 00294 00295 return 1; 00296 } 00297 00298 if ( sscanf( str, "%s %s", name, grund ) !=2 ) 00299 name = str; 00300 00301 if ( !name || !strlen(name) ) 00302 return 0; 00303 00304 name = lower_case(name); 00305 00306 if ( !grund || !stringp(grund) || lower_case(grund) != "loeschen" ){ 00307 "/secure/merlin"->MBanishInsert( name, grund, this_interactive() ); 00308 write( "Du setzt "+capitalize(name)+" auf die MBanish-Liste.\n" ); 00309 } 00310 else{ 00311 if ( !ARCH_SECURITY ){ 00312 write( "Das duerfen nur Erzmagier.\n" ); 00313 return 1; 00314 } 00315 "/secure/merlin"->MBanishDelete( name ); 00316 write( "Du loescht "+capitalize(name)+" von der MBanish-Liste.\n" ); 00317 } 00318 00319 return 1; 00320 }

| static int sbanish | ( | string | str | ) | [static] |
Definiert in Zeile 355 der Datei admin.c.
Benutzt _notify_fail(), _unparsed_args(), DOMAINMEMBER_LVL, dtime(), IPv4_int2addr(), IS_DEPUTY, keys, LORD_SECURITY, MASTER, secure_euid() und secure_level().
00356 { 00357 string ip; 00358 int days; 00359 mapping sites; 00360 00361 // Mindestens L26 fuer diesen Befehl 00362 if ( secure_level() <= DOMAINMEMBER_LVL ) 00363 return 0; 00364 00365 if ( !str || !stringp(str) || !strlen(str) ){ 00366 if ( !sizeof(sites = (mapping)MASTER->SiteBanish( 0, 0 )) ){ 00367 write( "Es sind zur Zeit keine Adressen gesperrt!\n" ); 00368 return 1; 00369 } 00370 00371 ip = " Adresse | gesperrt bis | gesperrt " 00372 + "durch\n========================================================" 00373 + "==============\n"; 00374 00375 int *keys = sort_array( m_indices(sites), #'</*'*/ ); 00376 00377 foreach(int key : keys) { 00378 ip += sprintf( " %:15-s | %:27-s | %-s\n", 00379 IPv4_int2addr(key), 00380 sites[key] > 0 ? dtime(sites[key]) : 00381 "St. Nimmerleinstag", 00382 capitalize(sites[key, 1]) ); 00383 } 00384 write( ip + "\n" ); 00385 return 1; 00386 } 00387 00388 _notify_fail("Syntax: sbanish <numerische ip> <tage>\n"); 00389 00390 if ( sscanf( this_player()->_unparsed_args(), "%s %d", ip, days ) != 2 ) 00391 return 0; 00392 00393 if ( !ip || !strlen(ip) ) 00394 return 0; 00395 00396 // _notify_fail( "Ungueltiges Adress-Format!\n" ); 00397 00398 if ( !days ){ 00399 int res=(int)MASTER->SiteBanish(ip, 0); 00400 if ( res == 1 ) 00401 printf( "Die Adresse '%s' ist jetzt nicht mehr gesperrt.\n", 00402 ip ); 00403 else if ( res == 0 ) 00404 printf( "Die Adresse '%s' war gar nicht gesperrt!\n", 00405 ip ); 00406 else 00407 printf( "Du darfst nur eigene Sperrungen wieder aufheben!\n" ); 00408 } 00409 else { 00410 int res; 00411 if ( days != 1 && !IS_DEPUTY(secure_euid()) ) 00412 write( "Du darfst Adressen nur fuer einen Tag sperren!\n" ); 00413 else if ( (res = (int)MASTER->SiteBanish(ip, days)) == 1 ) 00414 printf( "Die Adresse '%s' ist jetzt fuer %s gesperrt.\n", 00415 ip, (days > 1 ? sprintf( "%d Tage", days ) : 00416 (days > 0 ? "einen Tag" : "immer")) ); 00417 else if ( res == -1 ) 00418 write( "Du darfst " + (LORD_SECURITY ? "255 IP-Adressen" 00419 : "nur einzelne IP-Adressen") + " sperren!\n" ); 00420 else if ( res == -2 ) 00421 write( "Du hast schon genug Adressen gesperrt!\n" ); 00422 } 00423 00424 return 1; 00425 }

| static int shut_down_game | ( | string | str | ) | [static] |
Definiert in Zeile 54 der Datei admin.c.
Benutzt _notify_fail(), input_to() und IS_ARCH.
00055 { 00056 if (!IS_ARCH(this_object()) || this_object()!=this_interactive()) 00057 return 0; 00058 _notify_fail("Du musst einen Grund dafuer angeben.\n"); 00059 if (!str) return 0; 00060 write( "Direkter shutdown mit Grund \""+str+"\" (ja/nein) :" ); 00061 input_to("shut_down_game_2",0,str); 00062 return 1; 00063 }

| static int shut_down_game_2 | ( | string | arg, | |
| string | str | |||
| ) | [static] |
Definiert in Zeile 65 der Datei admin.c.
Benutzt IS_ARCH und shutdown().
00066 { 00067 if (!IS_ARCH(this_object()) || this_object()!=this_interactive()) 00068 return 0; 00069 if( arg!="ja" ) { 00070 write( "Shutdown abgebrochen.\n" ); 00071 } else { 00072 shutdown(str); 00073 } 00074 return 1; 00075 }

| static int sinners | ( | string | arg | ) | [static] |
Definiert in Zeile 159 der Datei admin.c.
Benutzt _unparsed_args(), i, IS_DEPUTY, lowerstring(), More() und notify_fail().
00160 { string *parts; 00161 int i; 00162 00163 if ( !IS_DEPUTY(this_object()) ) 00164 return 0; 00165 00166 arg=_unparsed_args()||arg; 00167 00168 notify_fail( 00169 "Syntax: suender ? => Liste aller Eingetragenen\n"+ 00170 " suender <name> => Eintraege lesen\n"+ 00171 " suender +<name> <text> => Eintrag hinzufuegen\n"+ 00172 " suender -<name> <nr> => Eintrag loeschen\n"+ 00173 " suender ! => Alle Eintraege dumpen\n"+ 00174 " suender * => Alle Eintraege anzeigen\n"); 00175 00176 if ( !stringp(arg) || (strlen(arg)<1) ) 00177 return 0; 00178 00179 if ( arg=="?" ) 00180 { 00181 write(call_other("/secure/sinmaster","ListSinners")); 00182 return 1; 00183 } 00184 if ( arg=="!" ) 00185 { 00186 write(call_other("/secure/sinmaster","Dump")); 00187 return 1; 00188 } 00189 if ( arg=="*" ) 00190 { 00191 More((string)call_other("/secure/sinmaster","Dump",1)); 00192 return 1; 00193 } 00194 00195 if ( (i=sizeof(parts=explode(arg," ")))<1 ) 00196 return 0; 00197 00198 if ( parts[0][0..0]=="-" ) 00199 { 00200 if ( i<2 ) 00201 return 0; 00202 write(call_other("/secure/sinmaster","RemoveSin", 00203 lowerstring(parts[0][1..]), 00204 to_int(parts[1]))); 00205 } 00206 else if ( parts[0][0..0]=="+" ) 00207 { 00208 if ( i<2 ) 00209 return 0; 00210 write(call_other("/secure/sinmaster","AddSin", 00211 lowerstring(parts[0][1..]), 00212 implode(parts[1..]," "))); 00213 } 00214 else 00215 { 00216 if ( i>1 ) 00217 return 0; 00218 write(call_other("/secure/sinmaster","ListSins", 00219 lowerstring(parts[0]))); 00220 } 00221 return 1; 00222 }

| static int tbanish | ( | string | str | ) | [static] |
Definiert in Zeile 323 der Datei admin.c.
Benutzt _notify_fail(), IS_DEPUTY, name, secure_euid() und TBanishName().
00324 { 00325 string name; 00326 int days; 00327 00328 if ( !IS_DEPUTY(secure_euid()) ) 00329 return 0; 00330 00331 _notify_fail("Syntax: tbanish <name> <tage>\n"); 00332 00333 if ( !str || !stringp(str) || !strlen(str) ) 00334 return 0; 00335 00336 if ( sscanf(str,"%s %d",name,days) != 2 ) 00337 return 0; 00338 00339 if ( !name || !strlen(name) ) 00340 return 0; 00341 00342 name = lower_case(name); 00343 00344 if ( !"/secure/master"->TBanishName( name, days ) ) 00345 return 1; 00346 00347 if ( !days ) 00348 write( "Okay, keine Spielpause fuer "+capitalize(name)+" mehr.\n" ); 00349 else 00350 write( "Du verpasst "+capitalize(name)+" eine Spielpause fuer "+ 00351 (days>0 ? days+" Tage" : "laaaange Zeit")+".\n" ); 00352 return 1; 00353 }

1.6.3