<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
[email protected]
https://mail.gna.org/listinfo/freeciv-dev