Re: [Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 On 12/10/2007, Pepeto _ wrote: + /cmdlevel and /cut send the username to the server, not the player name which can be different. + the /cmdlevel ctrl menu item really makes it, no /cut. This one committed. Remaining patch in this ticket is notify_conn_infos.diff - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 On 09/04/2008, Pepeto _ wrote: Agreed, that's why I was asking. So maybe an other ticket would be needed? #40202 Isn't the first patch of this ticket a good first step? It's adding tokenization separately for several commands. I don't see how such code duplication in middle-layer would work toward single high-level tokenization. Current lowlevel implementation at least avoids duplicate code. - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 On 09/04/2008, Pepeto _ wrote: [EMAIL PROTECTED] - Mar. Avr. 08 20:14:47 2008]: On 12/10/2007, Pepeto _ wrote: First step: clean up in stdinhand. /aitoggle, /remove, /cmdlevel and /cut support the arguments between quote marks. I believe this is redundant after #40196 patch. #40196 fixes lowlevel quoted string handling, this one adds higher level handling. Actually not, because the problems are more numerous. The client also sends wrong command names (e.g. /cut instead of /cmdlevel ctrl). Also it sends player names instead of connection names (e.g. /cmdlevel). Please note that I were talking about stdinhand.diff only. I understood that these problems are not solved in it, but in your other patches. Moreover, the quote stuff is used by get_player_by_name_prefix() and not by get_connection_by_name_prefix(), so connection usernames cannot be handled between quotes. True. get_connection_by_name_prefix() uses wrong callback. This should be trivial to fix as part of #40196. - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 [EMAIL PROTECTED] - Mer. Avr. 09 10:10:59 2008]: It will be rewritten when somebody decides to do so. Personally I think that there's much more urgent issues than cleanup for this part of the code, so I'm not doing it any time soon myself. Agreed, that's why I was asking. So maybe an other ticket would be needed? Patches welcome (for S2_2 and TRUNK, no unnecessary rewrites for STABLE2_1) Isn't the first patch of this ticket a good first step? ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 On 09/04/2008, Pepeto _ wrote: As you said, it's not as good as tokenize the command lines. So, would your patch for #40196 will be a temporary change or be a long stable way? It will be rewritten when somebody decides to do so. Personally I think that there's much more urgent issues than cleanup for this part of the code, so I'm not doing it any time soon myself. Patches welcome (for S2_2 and TRUNK, no unnecessary rewrites for STABLE2_1) - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 [EMAIL PROTECTED] - Mer. Avr. 09 09:31:58 2008]: On 09/04/2008, Pepeto _ wrote: [EMAIL PROTECTED] - Mar. Avr. 08 20:14:47 2008]: On 12/10/2007, Pepeto _ wrote: First step: clean up in stdinhand. /aitoggle, /remove, /cmdlevel and /cut support the arguments between quote marks. I believe this is redundant after #40196 patch. #40196 fixes lowlevel quoted string handling, this one adds higher level handling. Actually not, because the problems are more numerous. The client also sends wrong command names (e.g. /cut instead of /cmdlevel ctrl). Also it sends player names instead of connection names (e.g. /cmdlevel). Please note that I were talking about stdinhand.diff only. I understood that these problems are not solved in it, but in your other patches. Sorry, I didn't notice you were talking only about the stdinhand.diff patch. Moreover, the quote stuff is used by get_player_by_name_prefix() and not by get_connection_by_name_prefix(), so connection usernames cannot be handled between quotes. True. get_connection_by_name_prefix() uses wrong callback. This should be trivial to fix as part of #40196. As you said, it's not as good as tokenize the command lines. So, would your patch for #40196 will be a temporary change or be a long stable way? I really think that too many fix in this project have been done partially (fixing a mask over the real problems). Maybe time is to redesign some things entirely, what began to do Mr Simpson. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 On 12/10/2007, Pepeto _ wrote: First step: clean up in stdinhand. /aitoggle, /remove, /cmdlevel and /cut support the arguments between quote marks. I believe this is redundant after #40196 patch. #40196 fixes lowlevel quoted string handling, this one adds higher level handling. I have not yet inspected other patches in this ticket. - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 [EMAIL PROTECTED] - Mar. Avr. 08 20:14:47 2008]: On 12/10/2007, Pepeto _ wrote: First step: clean up in stdinhand. /aitoggle, /remove, /cmdlevel and /cut support the arguments between quote marks. I believe this is redundant after #40196 patch. #40196 fixes lowlevel quoted string handling, this one adds higher level handling. Actually not, because the problems are more numerous. The client also sends wrong command names (e.g. /cut instead of /cmdlevel ctrl). Also it sends player names instead of connection names (e.g. /cmdlevel). Moreover, the quote stuff is used by get_player_by_name_prefix() and not by get_connection_by_name_prefix(), so connection usernames cannot be handled between quotes. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 S2_1, S2_2 and trunk would need the 3 patch. S2_0 will need an adaptation of the second one. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 Third step: client connection list side. + /cmdlevel and /cut send the username to the server, not the player name which can be different. + the /cmdlevel ctrl menu item really makes it, no /cut. Patch attached Index: client/gui-gtk-2.0/pages.c === --- client/gui-gtk-2.0/pages.c (révision 13752) +++ client/gui-gtk-2.0/pages.c (copie de travail) @@ -1072,7 +1072,7 @@ / Miscellaneous callback for the conn menu that allows an arbitrary command - (/observe, /take, /hard) to be run on the player. + (/observe, /remove, /hard) to be run on the player. / static void conn_menu_player_command(GtkMenuItem *menuitem, gpointer data) { @@ -1104,6 +1104,23 @@ send_chat(buf); } +/ + Miscellaneous callback for the conn menu that allows an arbitrary command + (/cmdlevel, /cut) to be run on the connection. +/ +static void conn_menu_connection_command(GtkMenuItem *menuitem, gpointer data) +{ + char buf[1024]; + const char *command = data; + + assert(conn_menu_conn != NULL); + assert(command != NULL); + + my_snprintf(buf, sizeof(buf), /%s \%s\, + command, conn_menu_conn-username); + send_chat(buf); +} + /** Show details about a user in the Connected Users dialog in a popup. **/ @@ -1213,7 +1230,7 @@ (GtkDestroyNotify) gtk_widget_unref); gtk_container_add(GTK_CONTAINER(menu), entry); g_signal_connect(GTK_OBJECT(entry), activate, - GTK_SIGNAL_FUNC(conn_menu_player_command), cut); + GTK_SIGNAL_FUNC(conn_menu_connection_command), cut); } } @@ -1243,7 +1260,7 @@ (GtkDestroyNotify) gtk_widget_unref); gtk_container_add(GTK_CONTAINER(menu), entry); g_signal_connect(GTK_OBJECT(entry), activate, - GTK_SIGNAL_FUNC(conn_menu_player_command), + GTK_SIGNAL_FUNC(conn_menu_connection_command), cmdlevel info); entry = gtk_menu_item_new_with_label(_(Give ctrl access)); @@ -1251,7 +1268,8 @@ (GtkDestroyNotify) gtk_widget_unref); gtk_container_add(GTK_CONTAINER(menu), entry); g_signal_connect(GTK_OBJECT(entry), activate, - GTK_SIGNAL_FUNC(conn_menu_player_command), cut); + GTK_SIGNAL_FUNC(conn_menu_connection_command), + cmdlevel ctrl); /* No entry for hack access; that would be a serious security hole. */ } @@ -2467,4 +2485,3 @@ g_list_free(opts); } - ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 Second step: notify to the clients all changes about connections: + new created players names when a client joins. + lost detached connections. + when a player get detached after a /remove usage. + when a game is loaded with /load, notify all changes. Don't change the page if there are many connected users: the chat is removed, then the people cannot communicate or type commands. Patch attached Index: server/connecthand.c === --- server/connecthand.c (révision 13752) +++ server/connecthand.c (copie de travail) @@ -136,8 +136,6 @@ notify_conn(dest, NULL, E_CONNECTION, _(Couldn't attach your connection to new player.)); freelog(LOG_VERBOSE, %s is not attached to a player, pconn-username); -} else { - sz_strlcpy(pconn-player-name, pconn-username); } } @@ -428,6 +426,7 @@ pplayer = game.players[game.info.nplayers]; server_player_init(pplayer, FALSE, TRUE); game.info.nplayers++; + sz_strlcpy(pplayer-name, pconn-username); } } Index: server/sernet.c === --- server/sernet.c (révision 13752) +++ server/sernet.c (copie de travail) @@ -211,6 +211,8 @@ pconn-player = NULL; pconn-access_level = ALLOW_NONE; connection_common_close(pconn); + + send_conn_info(pconn-self, game.est_connections); } /* Index: server/stdinhand.c === --- server/stdinhand.c (révision 13752) +++ server/stdinhand.c (copie de travail) @@ -3266,6 +3266,15 @@ return TRUE; } + /* Detach all connection to prevent client crashes. */ + conn_list_iterate(game.est_connections, pconn) { +if (pconn-player) { + unattach_connection_from_player(pconn); +} + } conn_list_iterate_end; + send_conn_info(game.est_connections, game.est_connections); + send_player_info(NULL, NULL); + /* we found it, free all structures */ server_game_free(); @@ -3290,16 +3299,17 @@ send_game_info(game.est_connections); send_rulesets(game.est_connections); - /* Everything seemed to load ok; spread the good news. */ - send_load_game_info(TRUE); + /* send_load_game_info() don't work well for multi-players games. */ + if (conn_list_size(game.all_connections) == 1) { +send_load_game_info(TRUE); + } else { +send_player_info(NULL, NULL); + } /* attach connections to players. currently, this applies only * to connections that have the correct username. Any attachments * made before the game load are unattached. */ conn_list_iterate(game.est_connections, pconn) { -if (pconn-player) { - unattach_connection_from_player(pconn); -} players_iterate(pplayer) { if (strcmp(pconn-username, pplayer-username) == 0) { attach_connection_to_player(pconn, pplayer); @@ -3307,6 +3316,8 @@ } } players_iterate_end; } conn_list_iterate_end; + send_conn_info(game.est_connections, game.est_connections); + return TRUE; } Index: server/plrhand.c === --- server/plrhand.c (révision 13752) +++ server/plrhand.c (copie de travail) @@ -1127,6 +1127,7 @@ if (!unattach_connection_from_player(pconn)) { die(player had a connection attached that didn't belong to it!); } +send_conn_info(pconn-self, game.est_connections); } conn_list_iterate_end; team_remove_player(pplayer); ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39614) client connection list in start page
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39614 The connection list in gtk-2.0 client doesn't work well. This code should be rewritten. I won't explain all which don't work here or I will spend hours to explain. First, since you get some observers, you got a lot of gtk warnings about the parent iter which is not valid. Second, try to test the menu (when you click on a row with the right button). For example, click try to give a ctrl access level to a connection (user name pepeto, player name THE KILLER): Instead of having /cmdlevel ctrl \pepeto\, you get /cut \THE KILLER\!!! But not worry, /cut cannot work with the player name (/cmdlevel neither) and /cut \pepeto_ doesn't work neither because the server doesn't remove the ''. When you add this kind of feature, you should test it a but before commit them. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev