#include <reputation.h>#include <wizlevels.h>
gehe zum Quellcode dieser Datei
Funktionen | |
| protected void | create () |
| private int | Sec () |
| public int | AddReputation (string repid, mixed validuids, string name, string changemsg) |
| public int | DeactivateReputation (string repid) |
| public int | ActivateReputation (string repid) |
| public int | AddReputationUid (string repid, string uid) |
| public int | RemoveReputationUid (string repid, string uid) |
| public int | ChangeReputationName (string repid, string name) |
| public int | ChangeReputationMsg (string repid, string msg) |
| public varargs int | ViewReputationData (mixed repids) |
| public mapping | GetReputationData (string repid) |
| public string | GetDefaultChangeMsg (string repid, int value) |
| public int | CheckValidUid (string repid, object ob) |
| public int | CheckRepActive (string repid) |
Variablen | |
| private mapping | reputations |
| public int ActivateReputation | ( | string | repid | ) |
Definiert in Zeile 114 der Datei repmaster.c.
Benutzt REP_FLAG_ACTIVE, REP_SAVEFILE, reputations, save_object() und Sec().
00114 { 00115 if(!Sec()) 00116 return -1; 00117 if(!stringp(repid) || !strlen(repid)) 00118 return -2; 00119 if(!member(reputations, repid)) 00120 return -3; 00121 if(reputations[repid]["flags"] & REP_FLAG_ACTIVE) 00122 return -4; 00123 reputations[repid]["flags"] ^= REP_FLAG_ACTIVE; 00124 save_object(REP_SAVEFILE); 00125 return 1; 00126 }

| public int AddReputation | ( | string | repid, | |
| mixed | validuids, | |||
| string | name, | |||
| string | changemsg | |||
| ) |
Definiert in Zeile 55 der Datei repmaster.c.
Benutzt REP_FLAG_ACTIVE, REP_SAVEFILE, reputations, save_object() und Sec().
00056 { 00057 if(!Sec()) 00058 return -1; 00059 if(stringp(validuids)) validuids = ({ validuids }); 00060 if(!pointerp(validuids)) validuids = ({ }); 00061 // validuids + changemsgs kann auch erstmal leer bleiben 00062 if(!stringp(repid) || !strlen(repid) || !stringp(name) || !strlen(name)) 00063 return -2; 00064 if(member(reputations, repid)) 00065 return -3; 00066 reputations += ([ repid : ([ 00067 "uids": validuids, 00068 "name": name, 00069 "flags": REP_FLAG_ACTIVE, 00070 "changemsg": changemsg 00071 ]) ]); 00072 save_object(REP_SAVEFILE); 00073 tell_object(this_interactive(), sprintf("Reputation eingetragen:\n" 00074 "Name: %s\nValid UIDs: %O\nFlags: REP_FLAG_ACTIVE\nChangemsg: %s\n", 00075 reputations[repid]["name"], reputations[repid]["uids"], 00076 reputations[repid]["changemsg"])); 00077 return 1; 00078 }

| public int AddReputationUid | ( | string | repid, | |
| string | uid | |||
| ) |
Definiert in Zeile 139 der Datei repmaster.c.
Benutzt REP_SAVEFILE, reputations, save_object() und Sec().
00139 { 00140 if(!Sec()) 00141 return -1; 00142 if(!stringp(repid) || !strlen(repid) || !stringp(uid) || !strlen(uid)) 00143 return -2; 00144 if(!member(reputations, repid)) 00145 return -3; 00146 if(member(reputations[repid]["uids"], uid) != -1) 00147 return -4; 00148 reputations[repid]["uids"] += ({ uid }); 00149 save_object(REP_SAVEFILE); 00150 return 1; 00151 }

| public int ChangeReputationMsg | ( | string | repid, | |
| string | msg | |||
| ) |
Definiert in Zeile 214 der Datei repmaster.c.
Benutzt REP_SAVEFILE, reputations, save_object() und Sec().
00214 { 00215 if(!Sec()) 00216 return -1; 00217 if(!stringp(repid) || !strlen(repid) || !stringp(msg) || !strlen(msg)) 00218 return -2; 00219 if(!member(reputations, repid)) 00220 return -3; 00221 if(reputations[repid]["changemsg"] == msg) 00222 return -4; 00223 reputations[repid]["changemsg"] = msg; 00224 save_object(REP_SAVEFILE); 00225 return 1; 00226 }

| public int ChangeReputationName | ( | string | repid, | |
| string | name | |||
| ) |
Definiert in Zeile 189 der Datei repmaster.c.
Benutzt REP_SAVEFILE, reputations, save_object() und Sec().
00189 { 00190 if(!Sec()) 00191 return -1; 00192 if(!stringp(repid) || !strlen(repid) || !stringp(name) || !strlen(name)) 00193 return -2; 00194 if(!member(reputations, repid)) 00195 return -3; 00196 if(reputations[repid]["name"] == name) 00197 return -4; 00198 reputations[repid]["name"] = name; 00199 save_object(REP_SAVEFILE); 00200 return 1; 00201 }

| public int CheckRepActive | ( | string | repid | ) |
Definiert in Zeile 322 der Datei repmaster.c.
Benutzt REP_FLAG_ACTIVE und reputations.
00322 { 00323 if(!stringp(repid) || !strlen(repid)) 00324 return -1; 00325 if(!member(reputations, repid)) 00326 return -2; 00327 // Verboolung 00328 return !!(reputations[repid]["flags"] & REP_FLAG_ACTIVE); 00329 }
| public int CheckValidUid | ( | string | repid, | |
| object | ob | |||
| ) |
Definiert in Zeile 305 der Datei repmaster.c.
Benutzt reputations.
00305 { 00306 if(!stringp(repid) || !strlen(repid) || !objectp(ob)) 00307 return -1; 00308 if(!member(reputations, repid)) 00309 return -2; 00310 return (member(reputations[repid]["uids"], getuid(ob)) != -1); 00311 }
| protected void create | ( | ) |
Definiert in Zeile 26 der Datei repmaster.c.
Benutzt REP_SAVEFILE, reputations und restore_object().
00026 { 00027 seteuid(getuid(this_object())); 00028 00029 if(!restore_object(REP_SAVEFILE) || !mappingp(reputations)) 00030 reputations = ([ ]); 00031 }

| public int DeactivateReputation | ( | string | repid | ) |
Definiert in Zeile 90 der Datei repmaster.c.
Benutzt REP_FLAG_ACTIVE, REP_SAVEFILE, reputations, save_object() und Sec().
00090 { 00091 if(!Sec()) 00092 return -1; 00093 if(!stringp(repid) || !strlen(repid)) 00094 return -2; 00095 if(!member(reputations, repid)) 00096 return -3; 00097 if(!(reputations[repid]["flags"] & REP_FLAG_ACTIVE)) 00098 return -4; 00099 reputations[repid]["flags"] |= REP_FLAG_ACTIVE; 00100 save_object(REP_SAVEFILE); 00101 return 1; 00102 }

| public string GetDefaultChangeMsg | ( | string | repid, | |
| int | value | |||
| ) |
Definiert in Zeile 277 der Datei repmaster.c.
Benutzt abs und reputations.
00277 { 00278 string strength; 00279 if(!stringp(repid) || !strlen(repid) || !intp(value) || !value || 00280 !member(reputations, repid)) 00281 return 0; 00282 switch(abs(value)) { 00283 case 0..25 : strength = "kaum merklich"; break; 00284 case 26..50 : strength = "leicht"; break; 00285 case 51..100 : strength = "deutlich"; break; 00286 case 101..250 : strength = "erheblich"; break; 00287 case 251..1000: strength = "sehr stark"; break; 00288 default: strength = "ausserordentlich stark"; break; 00289 } 00290 return sprintf("Dein Ansehen %s hat sich%s%s.\n", 00291 reputations[repid]["changemsg"], (!strength ? " " : " "+ strength +" "), 00292 (value < 0 ? "verschlechtert" : "verbessert")); 00293 }
| public mapping GetReputationData | ( | string | repid | ) |
Definiert in Zeile 263 der Datei repmaster.c.
Benutzt reputations.
00263 { 00264 if(!stringp(repid) || !strlen(repid) || !member(reputations, repid)) 00265 return 0; 00266 return deep_copy(reputations[repid]); 00267 }
| public int RemoveReputationUid | ( | string | repid, | |
| string | uid | |||
| ) |
Definiert in Zeile 164 der Datei repmaster.c.
Benutzt REP_SAVEFILE, reputations, save_object() und Sec().
00164 { 00165 if(!Sec()) 00166 return -1; 00167 if(!stringp(repid) || !strlen(repid) || !stringp(uid) || !strlen(uid)) 00168 return -2; 00169 if(!member(reputations, repid)) 00170 return -3; 00171 if(member(reputations[repid]["uids"], uid) == -1) 00172 return -4; 00173 reputations[repid]["uids"] -= ({ uid }); 00174 save_object(REP_SAVEFILE); 00175 return 1; 00176 }

| private int Sec | ( | ) |
Definiert in Zeile 34 der Datei repmaster.c.
Benutzt ARCH_SECURITY, process_call() und ROOTID.
Wird benutzt von ActivateReputation(), AddReputation(), AddReputationUid(), ChangeReputationMsg(), ChangeReputationName(), DeactivateReputation() und RemoveReputationUid().
00034 { 00035 if(process_call()) return 0; 00036 if(previous_object() && geteuid(previous_object()) == ROOTID) return 1; 00037 return objectp(previous_object()) && ARCH_SECURITY; 00038 }


| public varargs int ViewReputationData | ( | mixed | repids | ) |
Definiert in Zeile 237 der Datei repmaster.c.
Benutzt REP_FLAG_ACTIVE und reputations.
00237 { 00238 // Fuer alle sichtbar, damit man ggf. weiss, wo man nachfragen muss 00239 if(!repids) repids = m_indices(reputations); 00240 else if(stringp(repids)) repids = ({ repids }); 00241 if(!pointerp(repids) || !sizeof(repids)) 00242 return -1; 00243 // Textausgabe fuer alle richtigen IDs 00244 foreach(string repid : repids) { 00245 if(!member(reputations, repid)) continue; 00246 tell_object(this_interactive(), sprintf("%s %s\n Name: %s\n Changemsg: " 00247 "%s\n ValidUIDS: %O\n\n", repid, 00248 (reputations[repid]["flags"] & REP_FLAG_ACTIVE ? "" : 00249 "(Inaktiv)"), reputations[repid]["name"], 00250 reputations[repid]["changemsg"], reputations[repid]["uids"])); 00251 } 00252 // Min. 1 nicht vorhanden: return -2, sonst 1 00253 return (sizeof(repids - m_indices(reputations)) ? -2 : 1); 00254 }
| private mapping reputations |
Definiert in Zeile 24 der Datei repmaster.c.
Wird benutzt von ActivateReputation(), AddReputation(), AddReputationUid(), ChangeReputation(), ChangeReputationMsg(), ChangeReputationName(), CheckRepActive(), CheckValidUid(), create(), DeactivateReputation(), GetDefaultChangeMsg(), GetReputation(), GetReputationData(), GetReputations(), RemoveReputationUid() und ViewReputationData().
1.6.3