#include <defines.h>#include <properties.h>#include <wizlevels.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | SIN_SAVE "/secure/ARCH/sins" |
| #define | SIN_LOG "ARCH/sins" |
| #define | SIN_DUMP "/secure/ARCH/sins.dump" |
Funktionen | |
| public void | create () |
| static void | save_me () |
| static private varargs int | is_allowed (int archonly) |
| public nomask int | query_prevent_shadow () |
| public string | ListSinners () |
| public string | ListSins (string who) |
| static void | _add_entry (string who, string entry, object pl) |
| public string | AddSin (string who, string text) |
| public string | RemoveSin (string who, int nr) |
| public varargs string | Dump (int flag) |
Variablen | |
| mapping | sins |
| #define SIN_DUMP "/secure/ARCH/sins.dump" |
Definiert in Zeile 9 der Datei sinmaster.c.
Wird benutzt von Dump().
| #define SIN_LOG "ARCH/sins" |
Definiert in Zeile 8 der Datei sinmaster.c.
Wird benutzt von _add_entry() und RemoveSin().
| #define SIN_SAVE "/secure/ARCH/sins" |
Definiert in Zeile 7 der Datei sinmaster.c.
| static void _add_entry | ( | string | who, | |
| string | entry, | |||
| object | pl | |||
| ) | [static] |
Definiert in Zeile 79 der Datei sinmaster.c.
Benutzt add, CAP, dtime(), log_file, save_me(), SIN_LOG und sins.
Wird benutzt von AddSin().
00080 { string *add; 00081 00082 if ( member(sins,who) && pointerp(sins[who]) && (sizeof(sins[who])>0) ) 00083 add = (string*)sins[who]; 00084 else 00085 add = ({ sprintf("Eintraege fuer '%s':",CAP(who)) }); 00086 00087 add += ({ entry }); 00088 00089 sins[who] = add; 00090 00091 save_me(); 00092 00093 log_file(SIN_LOG, 00094 sprintf("%s Eintrag fuer %s von %s\n", 00095 dtime(time()),CAP(who),CAP(getuid(pl)) ) ); 00096 }


| public string AddSin | ( | string | who, | |
| string | text | |||
| ) |
Definiert in Zeile 98 der Datei sinmaster.c.
Benutzt _add_entry(), break_string(), CAP, dtime(), find_netdead(), find_player(), is_allowed(), IS_WIZARD, P_SECOND, pl und RPL.
00099 { object pl; 00100 string ersti; 00101 00102 if ( !is_allowed() ) 00103 return "ACCESS DENIED\n"; 00104 00105 if ( !stringp(who) || (strlen(who)<1) 00106 || !stringp(text) || (strlen(text)<1) ) 00107 return "SYNTAX ERROR.\n"; 00108 00109 if ( text[0..2]=="-f " ) 00110 text=text[3..]; 00111 else if ( file_size(sprintf("/save/%s/%s.o",who[0..0],who))<1) 00112 return sprintf("Es gibt keinen Spieler namens '%s'\n",who); 00113 00114 text = dtime(time()) + " ("+CAP(getuid(RPL))+")\n" 00115 + break_string(text,78," " ); 00116 00117 _add_entry( who, text, RPL ); 00118 00119 if ( objectp(pl=(find_player(who)||find_netdead(who))) 00120 && !IS_WIZARD(pl) // Magier haben manchmal komische Ersties ... 00121 && stringp(ersti=(string)pl->QueryProp(P_SECOND)) ) 00122 { 00123 return ( sprintf("Ok.\nFuege Eintrag bei Ersti '%s' hinzu.\n",ersti) 00124 + AddSin( lower_case(ersti), ("-f siehe "+who) ) ); 00125 } 00126 00127 return "OK.\n"; 00128 }

| public void create | ( | ) |
Definiert in Zeile 19 der Datei sinmaster.c.
Benutzt ME, restore_object(), SIN_SAVE und sins.
00020 { 00021 seteuid(getuid(ME)); 00022 if ( !restore_object(SIN_SAVE) ) 00023 sins = ([]); 00024 }

| public varargs string Dump | ( | int | flag | ) |
Definiert in Zeile 170 der Datei sinmaster.c.
Benutzt dump(), i, is_allowed(), SIN_DUMP und sins.
00171 { string *snr,*sns,dump; 00172 int i,j,k,s,t; 00173 00174 if ( !is_allowed(0) ) 00175 return "ACCESS DENIED\n"; 00176 00177 if ( !flag && file_size(SIN_DUMP)>1 ) 00178 rm( SIN_DUMP ); 00179 00180 s=i=sizeof(snr=sort_array(m_indices(sins),#'<)); 00181 00182 if ( i<1 ) 00183 return "Keine Suender da.\n"; 00184 00185 dump = sprintf("\n%|78s\n%'='78.78s\n\n", 00186 sprintf("Dump der Suenden-Eintraege (%s):",dtime(time())), 00187 ""); 00188 00189 for ( --i,t=0 ; i>=0 ; i-- ) 00190 { 00191 j = sizeof(sns=sins[snr[i]]); 00192 t += (j-1); 00193 dump += ((string)sns[0]+"\n\n"); 00194 00195 for ( k=1 ; k<j ; k++ ) 00196 dump += sprintf("%3d: %s\n",k,(string)sns[k]); 00197 00198 dump += sprintf("%'='78.78s\n\n",""); 00199 } 00200 00201 dump += sprintf("Statistik:\n\n"+ 00202 " Es sind %d Suender mit insges. %d Eintraegen vorhanden.\n"+ 00203 " Das macht einen Schnitt von %.6f Eintraegen.\n\n", 00204 s,t,( to_float(t)/to_float(s) )); 00205 00206 if ( !flag ) 00207 { 00208 write_file(SIN_DUMP,dump); 00209 return sprintf("Es wurden %d Suender gedumped.\n",s); 00210 00211 } 00212 return dump; 00213 }

| static private varargs int is_allowed | ( | int | archonly | ) | [static] |
Definiert in Zeile 31 der Datei sinmaster.c.
Benutzt ARCH_SECURITY, IS_DEPUTY, process_call(), ROOTID und secure_euid().
Wird benutzt von AddSin(), Dump(), ListSinners(), ListSins() und RemoveSin().
00032 { 00033 if (previous_object() && geteuid(previous_object())==ROOTID) 00034 return 1; 00035 if (!process_call() && previous_object() && this_interactive() && (ARCH_SECURITY || (!archonly && IS_DEPUTY(secure_euid())) ) ) 00036 return 1; 00037 return 0; 00038 }


| public string ListSinners | ( | ) |
Definiert in Zeile 45 der Datei sinmaster.c.
Benutzt is_allowed() und sins.
00046 { string *names; 00047 00048 if ( !is_allowed() ) 00049 return "ACCESS DENIED\n"; 00050 00051 if ( sizeof(names=m_indices(sins))<1 ) 00052 return "Es sind keine Eintraege vorhanden.\n"; 00053 00054 names = sort_array( map( names, #'capitalize ), #'> ); 00055 00056 return sprintf("Liste der eingetragenen Suender:\n%#78.6s\n", 00057 implode(names,"\n")); 00058 }

| public string ListSins | ( | string | who | ) |
Definiert in Zeile 60 der Datei sinmaster.c.
Benutzt CAP, i, is_allowed() und sins.
00061 { string re; 00062 int i,j; 00063 00064 if ( !is_allowed() ) 00065 return "ACCESS DENIED\n"; 00066 00067 if ( !stringp(who) || (strlen(who)<1) ) 00068 return "SYNTAX ERROR.\n"; 00069 00070 if ( !member(sins,who) || !pointerp(sins[who]) || ((j=sizeof(sins[who]))<1) ) 00071 return sprintf("Es liegen keine Eintraege fuer '%s' vor.\n",CAP(who)); 00072 00073 for ( i=1, re = ((string)sins[who][0]+"\n") ; i<j ; i++ ) 00074 re += sprintf("%3d: %s\n",i,(string)sins[who][i]); 00075 00076 return re; 00077 }

| public nomask int query_prevent_shadow | ( | ) |
Definiert in Zeile 40 der Datei sinmaster.c.
| public string RemoveSin | ( | string | who, | |
| int | nr | |||
| ) |
Definiert in Zeile 130 der Datei sinmaster.c.
Benutzt CAP, dtime(), is_allowed(), log_file, m_delete(), RPL, save_me(), SIN_LOG und sins.
00131 { string *rem; 00132 00133 if ( !is_allowed(1) ) 00134 return "ACCESS DENIED\n"; 00135 00136 if ( !intp(nr) || (nr<1) || !stringp(who) || (strlen(who)<1) ) 00137 return "SYNTAX ERROR.\n"; 00138 00139 if ( !member(sins,who) || !pointerp(sins[who]) || (sizeof(sins[who])<1) ) 00140 return sprintf("FEHLER: Keine Eintraege fuer '%s' vorhanden.\n", 00141 CAP(who)); 00142 00143 rem = (string*)sins[who]; 00144 00145 if ( sizeof(rem)<=nr ) 00146 return "FEHLER: Diesen Eintrag gibt es nicht.\n"; 00147 00148 rem[nr] = 0; 00149 00150 rem -= ({ 0 }); 00151 00152 log_file(SIN_LOG, 00153 sprintf("%s Loeschung bei %s von %s\n", 00154 dtime(time()),CAP(who),CAP(getuid(RPL)) ) ); 00155 00156 00157 if ( sizeof(rem)<2 ) 00158 { 00159 efun::m_delete(sins,who); 00160 save_me(); 00161 return sprintf("Letzten Eintrag von '%s' geloescht.\n",CAP(who)); 00162 } 00163 00164 sins[who] = rem; 00165 save_me(); 00166 00167 return sprintf("Eintrag %d von '%s' geloescht.\n",nr,CAP(who)); 00168 }

| static void save_me | ( | ) | [static] |
Definiert in Zeile 26 der Datei sinmaster.c.
Benutzt save_object() und SIN_SAVE.
00027 { 00028 save_object(SIN_SAVE); 00029 }

| mapping sins |
Definiert in Zeile 17 der Datei sinmaster.c.
Wird benutzt von _add_entry(), create(), Dump(), ListSinners(), ListSins() und RemoveSin().
1.6.3