changeset 9674:a049733e41f3

[gaim-migrate @ 10526] Fix for "gaim-remote back" printing a gdk error when you weren't away (from me) Some white space fixes (from me and Bjoern) Fix for "gaim-remote -h away" not actually showing help (from Bjoern) committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 05 Aug 2004 16:24:54 +0000
parents 906949cd7a1e
children ba78e5a34bed
files src/away.c src/gaim-remote.c
diffstat 2 files changed, 46 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/src/away.c	Thu Aug 05 14:55:58 2004 +0000
+++ b/src/away.c	Thu Aug 05 16:24:54 2004 +0000
@@ -197,7 +197,8 @@
 	awaymessage = NULL;
 	awayqueue = NULL;
 	awayqueuesw = NULL;
-	g_object_unref(G_OBJECT(awayqueuestore));
+	if (awayqueuestore != NULL)
+		g_object_unref(G_OBJECT(awayqueuestore));
 	awayqueuestore = NULL;
 	serv_set_away_all(NULL);
 }
--- a/src/gaim-remote.c	Thu Aug 05 14:55:58 2004 +0000
+++ b/src/gaim-remote.c	Thu Aug 05 16:24:54 2004 +0000
@@ -48,7 +48,7 @@
 
 	text_output=(text_conv ? text_conv : text);
 	
-	switch(channel) {
+	switch (channel) {
 	case 1:  puts(text_output); break;
 	case 2:  fputs(text_output, stderr); break;
 	default: break;
@@ -60,22 +60,20 @@
 
 void show_remote_usage(char *name)
 {
-	char *text=NULL;
-
-	text=g_strdup_printf(_("Usage: %s command [OPTIONS] [URI]\n\n"
+	char *text = NULL;
 
-	     "    COMMANDS:\n"
-	     "       uri                      Handle AIM: URI\n"
-             "       away                     Popup the away dialog with the default message\n"
-             "       back                     Remove the away dialog\n"
-	     "       quit                     Close running copy of Gaim\n\n"
+	text = g_strdup_printf(_("Usage: %s command [OPTIONS] [URI]\n\n"
+		"    COMMANDS:\n"
+		"       uri                      Handle AIM: URI\n"
+		"       away                     Popup the away dialog with the default message\n"
+		"       back                     Remove the away dialog\n"
+		"       quit                     Close running copy of Gaim\n\n"
+		"    OPTIONS:\n"
+		"       -h, --help [command]     Show help for command\n"), name);
 
-	     "    OPTIONS:\n"
-	     "       -h, --help [command]     Show help for command\n"), name);
+	message(text, 1);
+	g_free(text);
 
-	message(text,1);
-	g_free(text);
-	
 	return;
 }
 
@@ -149,18 +147,18 @@
 	else
 		return 1;
 
-	if(opts.help)
+	if (opts.help)
 		return 0;
 
 	/* And we can have another argument--the URI. */
 	/* but only if we're using the uri command. */
 	if (!strcmp(opts.command, "uri")) {
-		if(argc-optind==1)
+		if (argc-optind == 1)
 			opts.uri = g_strdup(argv[optind++]);
 		else
 			return 1;
 	}
-	else if(optind==argc)
+	else if (optind == argc)
 		return 0;
 	else
 		return 1;
@@ -232,7 +230,7 @@
 }
 
 
-void show_longhelp_uri( char *name, char *command)
+void show_longhelp( char *name, char *command)
 {
 	if(!strcmp(command, "uri")) {
 		message(_("\n"
@@ -261,12 +259,6 @@
 	}
 }
 
-/* Work in progress - JBS
-int command_info(){
-	fprintf(stderr, "Info not yet implemented\n");
-    return 1;
-}*/
-
 int main (int argc, char *argv[])
 {
 
@@ -281,27 +273,37 @@
 		show_remote_usage(argv[0]);
 		return 0;
 	}
-	
-	
+
+
 	if (!strcmp(opts.command, "uri")) {
-		if(opts.help){
-			show_longhelp_uri(argv[0], "uri");
-		}else{
+		if (opts.help)
+			show_longhelp(argv[0], "uri");
+		else
 			return command_uri();
-		}
-/*	} else if (!strcmp(opts.command, "info")) {
-		return command_info();*/
-        } else if (!strcmp(opts.command, "away")) {
-                return command_away();
-        } else if (!strcmp(opts.command, "back")) {
-                return command_back();
-	} else if (!strcmp(opts.command, "quit")) {
-		if(opts.help){
-			show_longhelp_uri(argv[0], "quit");
-		}else{
+	}
+
+	else if (!strcmp(opts.command, "away")) {
+		if (opts.help)
+			show_longhelp(argv[0], "away");
+		else
+			return command_away();
+	}
+
+	else if (!strcmp(opts.command, "back")) {
+		if (opts.help)
+			show_longhelp(argv[0], "back");
+		else
+			return command_back();
+	}
+
+	else if (!strcmp(opts.command, "quit")) {
+		if (opts.help)
+			show_longhelp(argv[0], "quit");
+		else
 			return command_quit();
-		}
-	} else {
+	}
+
+	else {
 		show_remote_usage(argv[0]);
 		return 1;
 	}