From e05b72f2d772b765dd9bd54098cd2c4efbb7b06b Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Wed, 22 May 2013 10:43:00 +0200 Subject: [PATCH] flags_vlt attribute added to user class to manage volatile attributes (icon status and others) --- web/Obj/brisk.phh | 102 ++++++++++++++-------------------- web/Obj/user.phh | 18 +++++- web/briskin5/Obj/briskin5.phh | 12 ++-- web/commons.js | 17 ++++-- web/index_wr.php | 22 ++++---- web/room.js | 27 +++++---- 6 files changed, 101 insertions(+), 97 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 6bdcb84..44b00f4 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -601,11 +601,6 @@ class Table { } } - - - // $ret .= table_act_content(($user->subst == 'standup'), $this->table[$i]->player_n, $i, $user->table, - // ($this->table[$i]->auth_only == FALSE ? TRUE : $user->flags & USER_FLAG_AUTH)); - // function act_content($isstanding, $sitted, $table, $cur_table, $allowed) function act_content($user) { @@ -775,7 +770,7 @@ class Client_prefs { { // save into DB fprintf(STDERR, "QQ %s::%s PRE: %x\n", __CLASS__, __FUNCTION__, - $user->flags & (~USER_FLAG_S_ALL & ~USER_FLAG_AUTH)); + $user->flags & (~USER_FLAG_AUTH)); $user->flags_set(($this->listen << 2), USER_FLAG_MAP_AUTH); fprintf(STDERR, "QQ %s::%s %x\n", __CLASS__, __FUNCTION__, $user->flags); @@ -963,7 +958,7 @@ class Room if ($user_cur->sess == "") continue; - + if ($user_cur->lacc + EXPIRE_TIME_RD < ($curtime - $delta)) { // Auto logout dell'utente log_rd2("AUTO LOGOUT.".($user_cur->lacc + EXPIRE_TIME_RD)." curtime - delta ".($curtime - $delta)); @@ -1043,8 +1038,6 @@ class Room for ($i = 0 ; $i < TABLES_N ; $i++) { $ret .= $this->table_content($user, $i); - // $ret .= table_act_content(($user->subst == 'standup'), $this->table[$i]->player_n, $i, $user->table, - // ($this->table[$i]->auth_only == FALSE ? TRUE : $user->flags & USER_FLAG_AUTH)); $ret .= $this->table[$i]->act_content($user); if ($this->table[$i]->wag_own != -1) $ret .= sprintf('tra.add(%d, "%s: %s"); ', $i, $this->user[$this->table[$i]->wag_own]->name, $this->table[$i]->wag_com); @@ -1108,7 +1101,7 @@ class Room $user_cur = $this->user[$i]; if ($user_cur->sess == '' || $user_cur->stat != 'room') continue; - + // log_main("VALORI: name: ".$user_cur->name."from_table: ".$from_table." tab: ".$user_cur->table." taix: ".$table_idx." ucur: ".$user_cur." us: ".$user); $ret = "gst.st = ".($user_cur->step+1)."; ".($remove_wagon ? sprintf("tra.rem(%d);",$table_idx) : ""); @@ -1132,15 +1125,11 @@ class Room // clean the action buttons in other tables for ($e = 0 ; $e < TABLES_N ; $e++) { if ($this->table[$e]->player_n < PLAYERS_N) { - // $ret .= table_act_content(TRUE, 0, $e, $user->table, - // ($this->table[$e]->auth_only == FALSE ? TRUE : $user->flags & USER_FLAG_AUTH)); $ret .= $this->table[$e]->act_content($user); } } } else { - // $ret .= table_act_content(($user_cur->subst == 'standup'), $table->player_n, $table_idx, $user_cur->table, - // ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH)); $ret .= $table->act_content($user_cur); } } @@ -1215,8 +1204,6 @@ class Room $ret .= $this->table_content($user_cur, $table_idx); $ret .= $this->standup_content($user_cur); - // $ret .= table_act_content(FALSE, 0, $table_idx, $user_cur->table, - // ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH)); $ret .= $table->act_content($user_cur); @@ -1244,8 +1231,6 @@ class Room log_main("JOIN_WAKEUP wup_idx ".$wup_idx." wup_n ".$user_wup_n); log_main("JOIN_WAKEUP more"); - // $ret .= table_act_content(($user_cur->subst == 'standup'), $table->player_n, $table_idx, $user_cur->table, - // ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH)); $ret .= $table->act_content($user_cur); log_main("JOIN_WAKEUP end more"); @@ -1275,7 +1260,7 @@ class Room $user_cur = $this->user[$i]; if ($user_cur->sess == '' || $user_cur->stat != 'room') continue; - + $ret = "gst.st = ".($user_cur->step+1)."; "; if ($table_idx > -1) $ret .= $this->table_content($user_cur, $table_idx); @@ -1332,8 +1317,6 @@ class Room } else if ($table_idx > -1) { if ($table->player_n == PLAYERS_N) { - // $ret .= table_act_content(($user_cur->subst == 'standup'), PLAYERS_N, $table_idx, $user_cur->table, - /// ($table->auth_only == FALSE ? TRUE : $user_cur->flags & USER_FLAG_AUTH)); $ret .= $table->act_content($user_cur); } } @@ -1427,8 +1410,7 @@ class Room /* MLANG: "Alarm %s inviato a %s." */ $prestr = sprintf($mlang_brisk['alarret'][$G_lang], xcape(substr($msg, strlen($alarm_check))), ($target == "" ? $mlang_brisk['tit_all'][$G_lang] : xcape($target)) ); - $to_user = sprintf('chatt_sub("%s", [2, "%s"],%s);', - $dt, NICKSERV, $prestr); + $to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],%s);', $dt, NICKSERV, $prestr); $msg = sprintf("
%s

%s


", $dt.NICKSERV, xcape(substr($msg, strlen($alarm_check)))); @@ -1443,7 +1425,7 @@ class Room $flags_old = 0; if ($user->stat == 'room' && $user->subst == 'sitdown' && $user->table >= TABLES_AUTH_N) { - $to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['listmust'][$G_lang]); + $to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['listmust'][$G_lang]); } else { @@ -1476,7 +1458,7 @@ class Room } else { /* MLANG: "Per autenticare qualcuno devi a tua volta essere autenticato.", "Il nickname deve contenere almeno una lettera dell\'alfabeto o una cifra.", "Nickname %s già in uso." */ - $to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['authmust'][$G_lang]); + $to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['authmust'][$G_lang]); } } else if (strncmp($msg, "/mesgtoadm", 8) == 0) { @@ -1485,7 +1467,7 @@ class Room } else { /* MLANG: "Per inviare un messaggio devi essere autenticato." */ - $to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['mesgmust'][$G_lang]); + $to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['mesgmust'][$G_lang]); } } else if (strncmp($msg, "/nick ", 6) == 0) { @@ -1493,7 +1475,7 @@ class Room do { if (($name_new = validate_name(substr($msg, 6))) == FALSE) { - $to_user = sprintf('chatt_sub("%s", [2,"%s"],"%s");', $dt, NICKSERV, $mlang_brisk['nickmust'][$G_lang]); + $to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['nickmust'][$G_lang]); break; } @@ -1508,7 +1490,7 @@ class Room } if ($i < MAX_PLAYERS) { $prestr = sprintf($mlang_brisk['nickdupl'][$G_lang], xcape($name_new)); - $to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $prestr); + $to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $prestr); break; } @@ -1526,7 +1508,7 @@ class Room } } else { - $to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['authchan'][$G_lang]); + $to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['authchan'][$G_lang]); break; } } @@ -1539,7 +1521,7 @@ class Room /* MLANG: "Il nickname \'%s\' è già registrato, se il suo proprietario si autentificherà verrai rinominato d\'ufficio come ghostN." */ if ($bdb->login_exists($name_new)) { $prestr = sprintf($mlang_brisk['nickjust'][$G_lang], xcape($name_new)); - $to_user .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $prestr); + $to_user .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $prestr); } } } @@ -1606,14 +1588,13 @@ class Room } else { /* MLANG: "Questo stato non esiste." */ - $to_user = sprintf('chatt_sub("%s", [2,"%s"],"%s");', $dt, NICKSERV, $mlang_brisk['statunkn'][$G_lang]); + $to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['statunkn'][$G_lang]); break; } log_main("chatt_send start set"); - if (($user->flags & USER_FLAG_S_ALL) != $st) { - $update_room = TRUE; - $user->flags = ($user->flags & ~USER_FLAG_S_ALL) | $st; + if ($user->flags_vlt_set($st, USER_FLAG_S_ALL)) { + $update_room = TRUE; } } while (0); } // nick chat command @@ -1639,10 +1620,10 @@ class Room } if ($only_you) { - $to_user = sprintf('chatt_sub("%s", [%d, "%s"],"%s");', $dt, $user->flags, xcape($user->name), xcape("== chat ban ==")); + $to_user = sprintf('chatt_sub("%s", [%d, %d, "%s"],"%s");', $dt, $user->flags, $user->flags_vlt, xcape($user->name), xcape("== chat ban ==")); } else { - $to_user = sprintf('chatt_sub("%s", [%d, "%s"],"%s");', $dt, $user->flags, xcape($user->name), xcape($msg)); + $to_user = sprintf('chatt_sub("%s", [%d, %d, "%s"],"%s");', $dt, $user->flags, $user->flags_vlt, xcape($user->name), xcape($msg)); // temporary silentiation for troll (will became array check) // if (strcasecmp($user->name,'JackRokka') != 0 && $user->sess != '47ea653f602e8') $to_room = $to_user; @@ -2225,28 +2206,29 @@ class Room $user_cur_id = $user->idx_get(); for ($i = 0 , $ct = 0 ; $i < MAX_PLAYERS ; $i++) { - if ($this->user[$i]->sess == "" || $this->user[$i]->stat != "room" || $this->user[$i]->name == "") - continue; - - $flags = $this->user[$i]->flags; + if ($this->user[$i]->sess == "" || $this->user[$i]->stat != "room" || $this->user[$i]->name == "") + continue; - // sql record exists AND last donate > 2013-01-01 - if ($this->user[$i]->is_supp_custom()) { - $supp_comp_s = sprintf(', "%s"', $this->user[$i]->rec->supp_comp); - } - else { - $supp_comp_s = ''; - } + $flags = $this->user[$i]->flags; + $flags_vlt = $this->user[$i]->flags_vlt; - if ($this->user[$i]->subst == "standup") { - if ($user_cur_id == $i) { - $flags |= 1; - } - - $content .= sprintf('%s[ %d, "%s"%s ]',($ct > 0 ? ', ' : ''), $flags, - xcape($this->user[$i]->name), $supp_comp_s); - $ct++; - } + // sql record exists AND last donate > 2013-01-01 + if ($this->user[$i]->is_supp_custom()) { + $supp_comp_s = sprintf(', "%s"', $this->user[$i]->rec->supp_comp); + } + else { + $supp_comp_s = ''; + } + + if ($this->user[$i]->subst == "standup") { + if ($user_cur_id == $i) { + $flags |= 1; + } + $content .= sprintf('%s[ %d, %d, "%s"%s ]',($ct > 0 ? ', ' : ''), + $flags, $flags_vlt, + xcape($this->user[$i]->name), $supp_comp_s); + $ct++; + } } $content .= ' ]);'; @@ -2274,7 +2256,8 @@ class Room $user_cur = $this->user[$table->player[$i]]; $flags = $user_cur->flags; - + $flags_vlt = $user_cur->flags_vlt; + if ($user_cur_id == $table->player[$i]) $flags |= 1; @@ -2284,7 +2267,8 @@ class Room else $supp_comp_s = ''; - $content .= sprintf('%s[ %d, "%s"%s ]',($i == 0 ? '' : ', '), $flags, + $content .= sprintf('%s[ %d, %d, "%s"%s ]',($i == 0 ? '' : ', '), + $flags, $flags_vlt, xcape($user_cur->name), $supp_comp_s); } @@ -2859,7 +2843,7 @@ function root_welcome($user) $dt = date("H:i ", $curtime); for ($i = 0 ; $i < count($root_wellarr[$G_lang]) ; $i++) - $ret .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, str_replace('"', '\"', $root_wellarr[$G_lang][$i])); + $ret .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, str_replace('"', '\"', $root_wellarr[$G_lang][$i])); return ($ret); } diff --git a/web/Obj/user.phh b/web/Obj/user.phh index a2c3829..e0dd01d 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -121,6 +121,7 @@ class User { var $table_pos; // idx on the table var $table_token;// token that identify a game on a table var $flags; // Bitfield with: AUTHENTICATE: 0x02 + var $flags_vlt; // Volatile flags valid for this session only var $rec; // field with user db record or FALSE var $the_end; // Flag to change the end of the session @@ -174,6 +175,7 @@ class User { $thiz->exitislock = TRUE; $thiz->flags = 0x00; + $thiz->flags_vlt = 0x00; $thiz->rec = FALSE; $thiz->chattime = array_fill(0, CHAT_N, 0); @@ -220,6 +222,7 @@ class User { $this->exitislock = $from->exitislock; $this->flags = $from->flags; + $this->flags_vlt = $from->flags_vlt; $this->rec = $from->rec; $this->chattime = array(); @@ -285,6 +288,7 @@ class User { $thiz->the_end = $from->the_end; $thiz->flags = $from->flags; + $thiz->flags_vlt = $from->flags_vlt; $thiz->rec = $from->rec; $thiz->chattime = array_fill(0, CHAT_N, 0); @@ -305,8 +309,18 @@ class User { function flags_set($flags, $mask) { - $flags_old = $this->flags & (~$mask); - $this->flags = ($flags_old | ($flags & $mask)); + $flags_old = $this->flags; + $this->flags = (($flags_old & (~$mask)) | ($flags & $mask)); + + return ($flags_old != $this->flags); + } + + function flags_vlt_set($flags_vlt, $mask) + { + $flags_vlt_old = $this->flags_vlt; + $this->flags_vlt = (($flags_vlt_old & (~$mask)) | ($flags_vlt & $mask)); + + return ($flags_vlt_old != $this->flags_vlt); } function store_set() diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 10edf1b..4acdec0 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -1002,7 +1002,7 @@ class Bin5 { if (($name_new = validate_name(substr($user_mesg, 6))) == FALSE) { $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['nickmust'][$G_lang]); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['nickmust'][$G_lang]); $user->step_inc(); return; @@ -1021,7 +1021,7 @@ class Bin5 { $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; $premsg = sprintf($mlang_brisk['nickdupl'][$G_lang], xcape($name_new)); - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $premsg); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $premsg); $user->step_inc(); break; } @@ -1030,7 +1030,7 @@ class Bin5 { if ($user->flags & USER_FLAG_AUTH && strcasecmp($user->name,$name_new) != 0) { if ($this->table[$user->table]->auth_only == TRUE) { $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['authchan'][$G_lang]); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_brisk['authchan'][$G_lang]); $user->step_inc(); return; } @@ -1090,8 +1090,8 @@ class Bin5 { } $user_cur->comm[$user_cur->step % COMM_N] = "gst.st = ".($user_cur->step+1)."; "; - $user_cur->comm[$user_cur->step % COMM_N] .= sprintf('chatt_sub("%s", [%d, "%s"],"%s");', - $dt, $user->flags, xcape($user->name), xcape($user_mesg)); + $user_cur->comm[$user_cur->step % COMM_N] .= sprintf('chatt_sub("%s", [%d, %d, "%s"],"%s");', + $dt, $user->flags, $user->flags_vlt, xcape($user->name), xcape($user_mesg)); $user_cur->step_inc(); } log_legal($curtime, $user->ip, $user, ($user->stat == 'room' ? 'room' : 'table '.$user->table_orig),$user_mesg); @@ -1730,7 +1730,7 @@ function table_welcome($user) $ret = ""; for ($i = 0 ; $i < count($table_wellarr[$G_lang]) ; $i++) - $ret .= sprintf('chatt_sub("%s", [2, "ChanServ: "],"%s");', "", str_replace('"', '\"', $table_wellarr[$G_lang][$i])); + $ret .= sprintf('chatt_sub("%s", [2, 0, "ChanServ: "],"%s");', "", str_replace('"', '\"', $table_wellarr[$G_lang][$i])); return ($ret); } diff --git a/web/commons.js b/web/commons.js index 4cf95dc..713a4be 100644 --- a/web/commons.js +++ b/web/commons.js @@ -25,6 +25,11 @@ var PLAYERS_N = 3; var EXIT_BAN_TIME = 3600; var cookiepath = "/brisk/"; +var BSK_USER_FLAGS = 0; +var BSK_USER_FLGVL = 1; +var BSK_USER_NICK = 2; +var BSK_USER_SCOL = 3; + var mlang_commons = { 'imgload_a' : { 'it' : 'Immagine caricate ', 'en' : 'Loaded images ' }, 'imgload_b' : { 'it' : '%.', @@ -832,11 +837,12 @@ var CHATT_MAXLINES = 40; function user_decorator(user) { var name; - var flags = user[0]; + var flags = user[BSK_USER_FLAGS]; + var flags_vlt = user[BSK_USER_FLGVL]; if ((flags & 0x03) != 0) - name = ""+user[1]+""; + name = ""+user[BSK_USER_NICK]+""; else - name = user[1]; + name = user[BSK_USER_NICK]; return (name); } @@ -847,7 +853,8 @@ function user_dec_and_state(el) var val_el; content = user_decorator(el); - content += state_add(el[0],(typeof(el[2]) != 'undefined' ? el[2] : null)); + content += state_add(el[BSK_USER_FLAGS], el[BSK_USER_FLGVL], + (typeof(el[BSK_USER_SCOL]) != 'undefined' ? el[BSK_USER_SCOL] : null)); return (content); } @@ -860,7 +867,7 @@ function chatt_sub(dt,data,str) var name; var flags; var isauth; - var bolder = [ (data[0] | 1), data[1] ]; + var bolder = [ (data[BSK_USER_FLAGS] | 1), data[BSK_USER_FLGVL], data[BSK_USER_NICK] ]; name = user_decorator(bolder); if ($("txt").scrollTop + parseInt(getStyle($("txt"),"height", "height")) - $("txt").scrollHeight >= 0) diff --git a/web/index_wr.php b/web/index_wr.php index 5b05c68..ae8bfa7 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -280,13 +280,13 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) } else { /* MLANG: "E\' occorso un errore durante il salvataggio, riprova o contatta l\'amministratore." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); } } else { /* MLANG: "Per autenticare qualcuno devi a tua volta essere autenticato." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['warrmust'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['warrmust'][$G_lang]); } if ($mesg_to_user != "") { @@ -333,19 +333,19 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) } else { /* MLANG: "Il database è temporaneamente irraggiungibile, riprova più tardi o contatta l\'amministratore." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['coerrdb'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['coerrdb'][$G_lang]); $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; } } else { /* MLANG: "E\' occorso un errore durante il salvataggio, riprova o contatta l\'amministratore." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); } } else { /* MLANG: "Per autenticare qualcuno devi a tua volta essere autenticato." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['mesgmust'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['mesgmust'][$G_lang]); } if ($mesg_to_user != "") { @@ -389,7 +389,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) log_wr("INFO:SKIP:argz == poll name: [".$cli_poll_name."] AUTH: ".($user->flags & USER_FLAG_AUTH)); if (($user->flags & USER_FLAG_AUTH) != USER_FLAG_AUTH) { // MLANG: Per partecipare al sondaggio devi essere autenticato. - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['pollmust'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['pollmust'][$G_lang]); log_wr("break1"); break; } @@ -408,7 +408,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) if (($poll_lock = Poll::lock_data(TRUE)) == FALSE) { /* MLANG: "E\' occorso un errore durante il salvataggio, riprova o contatta l\'amministratore." */ - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); log_wr("break3"); break; } @@ -417,7 +417,7 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) $fp = @fopen(LEGAL_PATH."/".$G_poll_name.".txt", 'w+'); if ($fp == FALSE) { - $mesg_to_user = sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); + $mesg_to_user = sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['commerr'][$G_lang]); log_wr("break4"); break; } @@ -573,13 +573,13 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) /* MLANG: "Il server sta per essere riavviato, non possono avere inizio nuove partite.", "Il tavolo a cui volevi sederti richiede autentifica.", "Il tavolo si è appena liberato, ci si potrà sedere tra %d secondi." */ if ($G_shutdown) { - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['shutmsg'][$G_lang]); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['shutmsg'][$G_lang]); } else if ($table->auth_only && (($user->flags & USER_FLAG_AUTH) == 0)) { - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['mustauth'][$G_lang]); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s");', $dt, NICKSERV, $mlang_indwr['mustauth'][$G_lang]); } else { - $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, "%s"],"%s%d%s");', $dt, NICKSERV, $mlang_indwr['tabwait_a'][$G_lang], $table->wakeup_time - $curtime, $mlang_indwr['tabwait_b'][$G_lang]); + $user->comm[$user->step % COMM_N] .= sprintf('chatt_sub("%s", [2, 0, "%s"],"%s%d%s");', $dt, NICKSERV, $mlang_indwr['tabwait_a'][$G_lang], $table->wakeup_time - $curtime, $mlang_indwr['tabwait_b'][$G_lang]); } $user->step_inc(); return TRUE; diff --git a/web/room.js b/web/room.js index 85ea699..e3f08b0 100644 --- a/web/room.js +++ b/web/room.js @@ -24,20 +24,20 @@ /* - data = [ [ flags, name ], ... ] + data = [ [ flags, flags_vlt, name ], ... ] */ -function state_add(flags, comp) +function state_add(flags, flags_vlt, comp) { var content = "", supercont = ""; var st, superst, name = "", supername = "", supersfx = ""; var tit = "", supertit = ""; - if ((flags & 0xf00) != 0) { - st = flags & 0xf00; + if ((flags_vlt & 0xf00) != 0) { + st = flags_vlt & 0xf00; // MLANG 4,12,16,20,24,28 switch (st) { case 0x100: @@ -264,7 +264,7 @@ function j_stand_tdcont(el) } /* - ddata = [ [ , , ], ... ] + ddata = [ [ , , , ], ... ] */ function j_stand_cont(ddata) { @@ -279,7 +279,7 @@ function j_stand_cont(ddata) data = new Array(); for (i = 0, ii = 0 ; ii < ddata.length ; ii++) { - if ((ddata[ii][0] & 0x02) == 0) { + if ((ddata[ii][BSK_USER_FLAGS] & 0x02) == 0) { continue; } data[i++] = ddata[ii]; @@ -329,7 +329,7 @@ function j_stand_cont(ddata) // find removed entries for (i = 0 ; i < standup_data_old.length ; i++) { for (e = 0 ; e < data.length ; e++) { - if (standup_data_old[i][1] == data[e][1]) { + if (standup_data_old[i][BSK_USER_NICK] == data[e][BSK_USER_NICK]) { break; } } @@ -339,9 +339,10 @@ function j_stand_cont(ddata) } else { /* modified entries */ - if (standup_data_old[i][0] != data[e][0] || + if (standup_data_old[i][BSK_USER_FLAGS] != data[e][BSK_USER_FLAGS] || + standup_data_old[i][BSK_USER_FLGVL] != data[e][BSK_USER_FLGVL] || standup_data_old[i].length != data[e].length || - (data[e].length == 3 && standup_data_old[i][2] != data[e][2])) { + (data[e].length == 4 && standup_data_old[i][BSK_USER_SCOL] != data[e][BSK_USER_SCOL])) { arr_mod[idx_mod_n] = data[e]; idx_mod[idx_mod_n++] = i; } @@ -352,12 +353,12 @@ function j_stand_cont(ddata) // find new entries for (e = 0 ; e < data.length ; e++) { for (i = 0 ; i < standup_data_old.length ; i++) { - if (data[e][1] == standup_data_old[i][1] ) { + if (data[e][BSK_USER_NICK] == standup_data_old[i][BSK_USER_NICK] ) { break; } } if (i == standup_data_old.length) { - // console.log("ADD: "+data[e][1]); + // console.log("ADD: "+data[e][BSK_USER_NICK]); arr_add[idx_add_n] = data[e]; map_add[idx_add_n++] = e; } @@ -414,7 +415,7 @@ function j_stand_cont(ddata) // console.log("fineloop"); for (i ; i_add < idx_add_n ; i_add++, i++) { - // console.log("ADD: "+i+" arr_add: "+ arr_add[i_add][1]); + // console.log("ADD: "+i+" arr_add: "+ arr_add[i_add][BSK_USER_NICK]); td = document.createElement("td"); td.className = "room_standup"; td.id = map_add[i_add]; @@ -444,8 +445,6 @@ function j_tab_cont(table_idx, data) var content = ''; for (i = 0 ; i < data.length ; i++) { - // content += user_decorator(data[i]); - // content += state_add(data[i][0]); content += j_stand_tdcont(data[i]); content += '
'; -- 2.17.1