changeset 20735:f267a5b511ed

Better error handling when no libpurple dbus service is detected. This was Etan's suggestion. Fixes #3278.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 02 Oct 2007 02:17:53 +0000
parents 35a811e99c7d
children 2e711c2d080e
files libpurple/purple-remote
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/purple-remote	Mon Oct 01 17:54:21 2007 +0000
+++ b/libpurple/purple-remote	Tue Oct 02 02:17:53 2007 +0000
@@ -9,7 +9,12 @@
 
 xml.dom.minidom.Element.all   = xml.dom.minidom.Element.getElementsByTagName
 
-obj = dbus.SessionBus().get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
+obj = None
+try:
+    obj = dbus.SessionBus().get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
+except:
+    pass
+
 purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
 
 class CheckedObject:
@@ -212,7 +217,10 @@
 
 if len(sys.argv) == 1:
     show_help()
-
+elif (obj == None):
+    print "No existing libpurple instance detected."
+    sys.exit(1);
+    
 for arg in sys.argv[1:]:
     output = execute(arg)