changeset 7713:1adc71ed6d45

[gaim-migrate @ 8358] I noticed that this wasn't implemented while I was looking for the reason that kicks don't work properly for IRC with respect to removing the users in a channel ... the answer is simple, but in the process I was debugging with Gaim Commander and noticed this missing functionality. The beauty of Tcl is that it only took a few seconds to add it. (... and don't you all wish you had Gaim Commander?) committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Wed, 03 Dec 2003 02:03:44 +0000
parents 2823111061ba
children 3d9d3d21e600
files plugins/tcl/TCL-HOWTO plugins/tcl/tcl_cmds.c
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/tcl/TCL-HOWTO	Wed Dec 03 02:03:25 2003 +0000
+++ b/plugins/tcl/TCL-HOWTO	Wed Dec 03 02:03:44 2003 +0000
@@ -149,6 +149,7 @@
   and chats as described above.
 
 gaim::connection account gc
+gaim::connection displayname gc
 gaim::connection handle
 gaim::connection list
 
@@ -159,6 +160,9 @@
   account is the same account used by gaim::account and other
   commands.
 
+  'displayname' returns the display name (duh) of 'gc' as reported by
+  gaim_connection_get_display_name(gc).
+
   'handle' returns the gaim connections instance handle.  (See
   'gaim::signal connect').
 
--- a/plugins/tcl/tcl_cmds.c	Wed Dec 03 02:03:25 2003 +0000
+++ b/plugins/tcl/tcl_cmds.c	Wed Dec 03 02:03:44 2003 +0000
@@ -400,8 +400,8 @@
 int tcl_cmd_connection(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	Tcl_Obj *result = Tcl_GetObjResult(interp), *list, *elem;
-	char *cmds[] = { "account", "handle", "list", NULL };
-	enum { CMD_CONN_ACCOUNT, CMD_CONN_HANDLE, CMD_CONN_LIST } cmd;
+	char *cmds[] = { "account", "displayname", "handle", "list", NULL };
+	enum { CMD_CONN_ACCOUNT, CMD_CONN_DISPLAYNAME, CMD_CONN_HANDLE, CMD_CONN_LIST } cmd;
 	int error;
 	GList *cur;
 	GaimConnection *gc;
@@ -427,6 +427,18 @@
 		}
 		Tcl_SetIntObj(result, (int)gaim_connection_get_account(gc));
 		break;
+	case CMD_CONN_DISPLAYNAME:
+		if (objc != 3) {
+			Tcl_WrongNumArgs(interp, 2, objv, "gc");
+			return TCL_ERROR;
+		}
+		error = Tcl_GetIntFromObj(interp, objv[2], (int *)&gc);
+		if (error || !tcl_validate_gc(gc)) {
+			Tcl_SetStringObj(result, "invalid gc", -1);
+			return TCL_ERROR;
+		}
+		Tcl_SetStringObj(result, (char *)gaim_connection_get_display_name(gc), -1);
+		break;
 	case CMD_CONN_HANDLE:
 		if (objc != 2) {
 			Tcl_WrongNumArgs(interp, 2, objv, "");