diff libpurple/purple-remote @ 23070:4b4be7609072

Import a patch (with changes) from Debian: * 20_purple-remote_friendly.patch: - Make error messages friendlier when python-dbus is not installed or if someone calls purple-remote/purple-url-handler with --help or -h (Closes: #413204) committer: Richard Laager <rlaager@wiktel.com>
author Ari Pollak <ari@debian.org>
date Wed, 21 May 2008 21:05:09 +0000
parents fefe61275687
children 94f3d88b5dc5
line wrap: on
line diff
--- a/libpurple/purple-remote	Mon May 12 02:03:13 2008 +0000
+++ b/libpurple/purple-remote	Wed May 21 21:05:09 2008 +0000
@@ -35,7 +35,7 @@
             raise "Error: " + self.attr + " " + str(args) + " returned " + str(result)
         return result
             
-def show_help():
+def show_help(requested=False):
     print """This program uses D-Bus to communicate with purple.
 
 Usage:
@@ -66,6 +66,10 @@
     PurpleAccountsFindConnected?name=&protocol=prpl-jabber
     PurpleAccountsFindConnected(,prpl-jabber)
 """ % sys.argv[0]
+    if (requested):
+        sys.exit(0)
+    else:
+        sys.exit(1)
 
 cpurple = CheckedObject(purple)
 
@@ -213,10 +217,11 @@
                                 raise "Don't know how to handle type \"%s\"" % type
                     return purple.__getattr__(command)(*methodparams)
             show_help()
-            raise "Unknown command: %s" % command
 
 if len(sys.argv) == 1:
     show_help()
+elif (sys.argv[1] == "--help" or sys.argv[1] == "-h"):
+    show_help(True)
 elif (obj == None):
     print "No existing libpurple instance detected."
     sys.exit(1);