ja ja ja!

This commit is contained in:
psyc://psyced.org/~lynX 2010-03-01 19:18:31 +01:00
parent d52ad5084c
commit 7fca953dde
2 changed files with 13 additions and 11 deletions

View File

@ -172,20 +172,22 @@ varargs void w(string mc, string data, mixed vars) {
} }
#endif #endif
// a simple implementation of perl's x operator // a simple implementation of perl's x repetition operator
string x(string str, int n) { string repeat(string str, int n) {
int i; int i;
string res = ""; string res = "";
for (i = 0; i < n; i++) res += str; for (i = 0; i < n; i++) res += str;
return res; return res;
} }
int is_true(string v) { int is_true(string v) {
if (strlen(v) && regmatch(v, "^(?:on|yes|true|enabled|1)$")) return 1; if (strlen(v) && regmatch(v, "^(?:on|yes|y|ja|true|enabled|1)$"))
return 0; return 1;
return 0;
} }
int is_false(string v) { int is_false(string v) {
if (strlen(v) && regmatch(v, "^(?:off|no|false|disabled|0)$")) return 1; if (strlen(v) && regmatch(v, "^(?:off|no|n|nein|false|disabled|0)$"))
return 0; return 1;
return 0;
} }

View File

@ -180,7 +180,7 @@ sendEntries(mixed source, array(mixed) entries, int level) {
vars = entry[LOG_VARS]; vars = entry[LOG_VARS];
sendmsg(source, regreplace(entry[LOG_MC], "^_notice", "_list", 1), sendmsg(source, regreplace(entry[LOG_MC], "^_notice", "_list", 1),
"[_indent][_nick]: "+ (vars["_title"] ? "[_title]\n" : "") +"[_text] (#[_id])", "[_indent][_nick]: "+ (vars["_title"] ? "[_title]\n" : "") +"[_text] (#[_id])",
vars + ([ "_level": level, "_indent": x(" ", level), "_postfix_time_log": 1 ])); vars + ([ "_level": level, "_indent": repeat(" ", level), "_postfix_time_log": 1 ]));
if (sizeof(entry) >= LOG_CHILDREN + 1) sendEntries(source, entry[LOG_CHILDREN], level + 1); if (sizeof(entry) >= LOG_CHILDREN + 1) sendEntries(source, entry[LOG_CHILDREN], level + 1);
n++; n++;
} }