changeset 15654:898fe63dd008

Fix bug #1662186: "gaim-remote --help doesn't work" by showing the help for any invalid command.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 18 Feb 2007 22:00:44 +0000
parents 836d7c247d22
children 650e24726180
files libpurple/gaim-remote
diffstat 1 files changed, 34 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/gaim-remote	Sun Feb 18 04:49:56 2007 +0000
+++ b/libpurple/gaim-remote	Sun Feb 18 22:00:44 2007 +0000
@@ -30,6 +30,38 @@
             raise "Error: " + self.attr + " " + str(args) + " returned " + str(result)
         return result
             
+def show_help():
+    print """This program uses DBus to communicate with gaim.
+
+Usage:
+
+    %s "command1" "command2" ...
+
+Each command is of one of the three types:
+
+    [protocol:]commandname?param1=value1&param2=value2&...
+    FunctionName?param1=value1&param2=value2&...
+    FunctionName(value1,value2,...)
+
+The second and third form are provided for completeness but their use
+is not recommended; use gaim-send or gaim-send-async instead.  The
+second form uses introspection to find out the parameter names and
+their types, therefore it is rather slow.
+
+Examples of commands:
+
+    jabber:goim?screenname=testone@localhost&message=hi
+    jabber:gochat?room=TestRoom&server=conference.localhost
+    jabber:getinfo?screenname=testone@localhost
+    jabber:addbuddy?screenname=my friend
+
+    setstatus?status=away&message=don't disturb
+    quit
+
+    GaimAccountsFindConnected?name=&protocol=prpl-jabber
+    GaimAccountFindConnected(,prpl-jabber)
+""" % sys.argv[0]
+
 cgaim = CheckedObject(gaim)
 
 urlregexp = r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?"
@@ -169,40 +201,11 @@
                             else:
                                 raise "Don't know how to handle type \"%s\"" % type
                     return gaim.__getattr__(command)(*methodparams)
+            show_help()
             raise "Unknown command: %s" % command
 
-
 if len(sys.argv) == 1:
-    print """This program uses DBus to communicate with gaim.
-
-Usage:
-
-    %s "command1" "command2" ...
-
-Each command is of one of the three types:
-
-    [protocol:]commandname?param1=value1&param2=value2&...
-    FunctionName?param1=value1&param2=value2&...
-    FunctionName(value1,value2,...)
-
-The second and third form are provided for completeness but their use
-is not recommended; use gaim-send or gaim-send-async instead.  The
-second form uses introspection to find out the parameter names and
-their types, therefore it is rather slow.
-
-Examples of commands:
-
-    jabber:goim?screenname=testone@localhost&message=hi
-    jabber:gochat?room=TestRoom&server=conference.localhost
-    jabber:getinfo?screenname=testone@localhost
-    jabber:addbuddy?screenname=my friend
-
-    setstatus?status=away&message=don't disturb
-    quit
-
-    GaimAccountsFindConnected?name=&protocol=prpl-jabber
-    GaimAccountFindConnected(,prpl-jabber)
-""" % sys.argv[0]
+    show_help()
 
 for arg in sys.argv[1:]:
     output = execute(arg)