# HG changeset patch # User Richard Laager # Date 1176660554 0 # Node ID 598b1b15b1997e79e69b2b263a176714f3fbf020 # Parent 74b2d576f45845f8de8c577744fc3c1b58f79b1c Trac Ticket #149 from JensenDied This patch does a rename of our DBus stuff. diff -r 74b2d576f458 -r 598b1b15b199 Makefile.am --- a/Makefile.am Sun Apr 15 18:06:49 2007 +0000 +++ b/Makefile.am Sun Apr 15 18:09:14 2007 +0000 @@ -13,7 +13,7 @@ config.h.mingw \ gaim.pc.in \ gaim-uninstalled.pc.in \ - gaim.service.in \ + purple.service.in \ intltool-extract.in \ intltool-merge.in \ intltool-update.in \ @@ -26,7 +26,7 @@ if ENABLE_DBUS dbus_servicedir=$(DBUS_SERVICES_DIR) -dbus_service_DATA=gaim.service +dbus_service_DATA=purple.service endif dist-hook: pidgin.spec diff -r 74b2d576f458 -r 598b1b15b199 configure.ac --- a/configure.ac Sun Apr 15 18:06:49 2007 +0000 +++ b/configure.ac Sun Apr 15 18:09:14 2007 +0000 @@ -1893,7 +1893,7 @@ AC_OUTPUT([Makefile Doxyfile - gaim.service + purple.service doc/Makefile doc/pidgin.1 doc/finch.1 diff -r 74b2d576f458 -r 598b1b15b199 finch/libgnt/pygnt/dbus-gnt --- a/finch/libgnt/pygnt/dbus-gnt Sun Apr 15 18:06:49 2007 +0000 +++ b/finch/libgnt/pygnt/dbus-gnt Sun Apr 15 18:09:14 2007 +0000 @@ -37,23 +37,23 @@ gnt.gnt_init() bus = dbus.SessionBus() -obj = bus.get_object("net.sf.purple.PurpleService", "/net/sf/purple/PurpleObject") -purple = dbus.Interface(obj, "net.sf.purple.PurpleInterface") +obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") +purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") bus.add_signal_receiver(buddysignedon, - dbus_interface = "net.sf.purple.PurpleInterface", + dbus_interface = "im.pidgin.purple.PurpleInterface", signal_name = "BuddySignedOn") bus.add_signal_receiver(wrote_msg, - dbus_interface = "net.sf.purple.PurpleInterface", + dbus_interface = "im.pidgin.purple.PurpleInterface", signal_name = "WroteImMsg") bus.add_signal_receiver(wrote_msg, - dbus_interface = "net.sf.purple.PurpleInterface", + dbus_interface = "im.pidgin.purple.PurpleInterface", signal_name = "WroteChatMsg") bus.add_signal_receiver(conv_closed, - dbus_interface = "net.sf.purple.PurpleInterface", + dbus_interface = "im.pidgin.purple.PurpleInterface", signal_name = "DeletingConversation") def get_dict_key(conv): diff -r 74b2d576f458 -r 598b1b15b199 gaim.service.in --- a/gaim.service.in Sun Apr 15 18:06:49 2007 +0000 +++ b/gaim.service.in Sun Apr 15 18:09:14 2007 +0000 @@ -1,3 +1,3 @@ [D-BUS Service] -Name=org.gaim.GaimService -Exec=@bindir@/gaim +Name=im.pidgin.purple.PurpleService +Exec=/bin/false diff -r 74b2d576f458 -r 598b1b15b199 libpurple/dbus-purple.h --- a/libpurple/dbus-purple.h Sun Apr 15 18:06:49 2007 +0000 +++ b/libpurple/dbus-purple.h Sun Apr 15 18:09:14 2007 +0000 @@ -24,8 +24,8 @@ #ifndef _DBUS_PURPLE_H_ #define _DBUS_PURPLE_H_ -#define DBUS_SERVICE_PURPLE "net.sf.purple.PurpleService" -#define DBUS_PATH_PURPLE "/net/sf/purple/PurpleObject" -#define DBUS_INTERFACE_PURPLE "net.sf.purple.PurpleInterface" +#define DBUS_SERVICE_PURPLE "im.pidgin.purple.PurpleService" +#define DBUS_PATH_PURPLE "/im/pidgin/purple/PurpleObject" +#define DBUS_INTERFACE_PURPLE "im.pidgin.purple.PurpleInterface" #endif /* _DBUS_PURPLE_H_ */ diff -r 74b2d576f458 -r 598b1b15b199 libpurple/dbus-server.c --- a/libpurple/dbus-server.c Sun Apr 15 18:06:49 2007 +0000 +++ b/libpurple/dbus-server.c Sun Apr 15 18:09:14 2007 +0000 @@ -143,7 +143,7 @@ gint id = purple_dbus_pointer_to_id(ptr); if (ptr != NULL && id == 0) - dbus_set_error(error, "net.sf.purple.ObjectNotFound", + dbus_set_error(error, "im.pidgin.purple.ObjectNotFound", "The return object is not mapped (this is a Purple error)"); return id; @@ -156,7 +156,7 @@ gpointer ptr = purple_dbus_id_to_pointer(id, type); if (ptr == NULL && id != 0) - dbus_set_error(error, "net.sf.purple.InvalidHandle", + dbus_set_error(error, "im.pidgin.purple.InvalidHandle", "%s object with ID = %i not found", typename, id); return ptr; diff -r 74b2d576f458 -r 598b1b15b199 libpurple/plugins/dbus-buddyicons-example.py --- a/libpurple/plugins/dbus-buddyicons-example.py Sun Apr 15 18:06:49 2007 +0000 +++ b/libpurple/plugins/dbus-buddyicons-example.py Sun Apr 15 18:09:14 2007 +0000 @@ -2,7 +2,7 @@ # # Print the aliases of buddies who have a buddy-icon set. # -# Gaim is the legal property of its developers, whose names are too numerous +# Purple is the legal property of its developers, whose names are too numerous # to list here. Please refer to the COPYRIGHT file distributed with this # source distribution. # @@ -24,13 +24,13 @@ import dbus bus = dbus.SessionBus() -obj = bus.get_object("net.sf.gaim.GaimService", "/net/sf/gaim/GaimObject") -gaim = dbus.Interface(obj, "net.sf.gaim.GaimInterface") +obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") +purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") -node = gaim.GaimBlistGetRoot() +node = purple.PurpleBlistGetRoot() while node != 0: - if gaim.GaimBlistNodeIsBuddy(node): - icon = gaim.GaimBuddyGetIcon(node) + if purple.PurpleBlistNodeIsBuddy(node): + icon = purple.PurpleBuddyGetIcon(node) if icon != 0: - print gaim.GaimBuddyGetAlias(node) - node = gaim.GaimBlistNodeNext(node, 0) + print purple.PurpleBuddyGetAlias(node) + node = purple.PurpleBlistNodeNext(node, 0) diff -r 74b2d576f458 -r 598b1b15b199 libpurple/purple-notifications-example --- a/libpurple/purple-notifications-example Sun Apr 15 18:06:49 2007 +0000 +++ b/libpurple/purple-notifications-example Sun Apr 15 18:09:14 2007 +0000 @@ -1,12 +1,12 @@ #!/usr/bin/env python -# This is a simple gaim notification server. +# This is a simple purple notification server. # It shows notifications when your buddy signs on or you get an IM message. # # This script requires Python 2.4 and PyGTK bindings # # Note that all function names are resolved dynamically, no -# gaim-specific library is needed. +# purple-specific library is needed. import dbus import dbus.glib @@ -19,12 +19,12 @@ return conversation else: # 1 = GAIM_CONV_IM - return gaim.GaimConversationNew(1, account, name) + return purple.PurpleConversationNew(1, account, name) def receivedimmsg(account, name, message, conversation, flags): - buddy = gaim.GaimFindBuddy(account, name) + buddy = purple.PurpleFindBuddy(account, name) if buddy != 0: - alias = gaim.GaimBuddyGetAlias(buddy) + alias = purple.PurpleBuddyGetAlias(buddy) else: alias = name @@ -38,19 +38,19 @@ conversation = ensureimconversation(conversation, account, name) if code == 102: # show me - window = gaim.GaimConversationGetWindow(conversation) - gaim.GaimConvWindowRaise(window) + window = purple.PurpleConversationGetWindow(conversation) + purple.PurpleConvWindowRaise(window) if code == 103: # close - gaim.GaimConversationDestroy(conversation) + purple.PurpleConversationDestroy(conversation) if code == 104: # abuse - im = gaim.GaimConversationGetImData(conversation) - gaim.GaimConvImSend(im, "Go away you f...") + im = purple.PurpleConversationGetImData(conversation) + purple.PurpleConvImSend(im, "Go away you f...") def buddysignedon(buddyid): - alias = gaim.GaimBuddyGetAlias(buddyid) + alias = purple.PurpleBuddyGetAlias(buddyid) text = "%s is online" % alias code = os.spawnlp(os.P_WAIT, "xmessage", "xmessage", "-buttons", @@ -60,24 +60,24 @@ pass if code == 102: # talk - name = gaim.GaimBuddyGetName(buddyid) - account = gaim.GaimBuddyGetAccount(buddyid) - gaim.GaimConversationNew(1, account, name) + name = purple.PurpleBuddyGetName(buddyid) + account = purple.PurpleBuddyGetAccount(buddyid) + purple.PurpleConversationNew(1, account, name) bus = dbus.SessionBus() -obj = bus.get_object("net.sf.gaim.GaimService", "/net/sf/gaim/GaimObject") -gaim = dbus.Interface(obj, "net.sf.gaim.GaimInterface") +obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") +purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") bus.add_signal_receiver(receivedimmsg, - dbus_interface = "net.sf.gaim.GaimInterface", + dbus_interface = "im.pidgin.purple.PurpleInterface", signal_name = "ReceivedImMsg") bus.add_signal_receiver(buddysignedon, - dbus_interface = "net.sf.gaim.GaimInterface", + dbus_interface = "im.pidgin.purple.PurpleInterface", signal_name = "BuddySignedOn") -print "This is a simple gaim notification server." +print "This is a simple purple notification server." print "It shows notifications when your buddy signs on or you get an IM message." loop = gobject.MainLoop() diff -r 74b2d576f458 -r 598b1b15b199 libpurple/purple-remote --- a/libpurple/purple-remote Sun Apr 15 18:06:49 2007 +0000 +++ b/libpurple/purple-remote Sun Apr 15 18:09:14 2007 +0000 @@ -9,8 +9,8 @@ xml.dom.minidom.Element.all = xml.dom.minidom.Element.getElementsByTagName -obj = dbus.SessionBus().get_object("net.sf.gaim.GaimService", "/net/sf/gaim/GaimObject") -gaim = dbus.Interface(obj, "net.sf.gaim.GaimInterface") +obj = dbus.SessionBus().get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") +purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") class CheckedObject: def __init__(self, obj): @@ -31,7 +31,7 @@ return result def show_help(): - print """This program uses DBus to communicate with gaim. + print """This program uses DBus to communicate with purple. Usage: @@ -44,7 +44,7 @@ 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 +is not recommended; use purple-send or purple-send-async instead. The second form uses introspection to find out the parameter names and their types, therefore it is rather slow. @@ -58,11 +58,11 @@ setstatus?status=away&message=don't disturb quit - GaimAccountsFindConnected?name=&protocol=prpl-jabber - GaimAccountFindConnected(,prpl-jabber) + PurpleAccountsFindConnected?name=&protocol=prpl-jabber + PurpleAccountFindConnected(,prpl-jabber) """ % sys.argv[0] -cgaim = CheckedObject(gaim) +cpurple = CheckedObject(purple) urlregexp = r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?" @@ -81,13 +81,13 @@ def findaccount(accountname, protocolname): try: # prefer connected accounts - account = cgaim.GaimAccountsFindConnected(accountname, protocolname) + account = cpurple.PurpleAccountsFindConnected(accountname, protocolname) return account except: # try to get any account and connect it - account = cgaim.GaimAccountsFindAny(accountname, protocolname) - gaim.GaimAccountSetStatusVargs(account, "online", 1) - gaim.GaimAccountConnect(account) + account = cpurple.PurpleAccountsFindAny(accountname, protocolname) + purple.PurpleAccountSetStatusVargs(account, "online", 1) + purple.PurpleAccountConnect(account) return account @@ -110,60 +110,60 @@ if command == "goim": account = findaccount(accountname, protocol) - conversation = cgaim.GaimConversationNew(1, account, params["screenname"]) + conversation = cpurple.PurpleConversationNew(1, account, params["screenname"]) if "message" in params: - im = cgaim.GaimConversationGetImData(conversation) - gaim.GaimConvImSend(im, params["message"]) + im = cpurple.PurpleConversationGetImData(conversation) + purple.PurpleConvImSend(im, params["message"]) return None elif command == "gochat": account = findaccount(accountname, protocol) - connection = cgaim.GaimAccountGetConnection(account) - return gaim.ServJoinChat(connection, params) + connection = cpurple.PurpleAccountGetConnection(account) + return purple.ServJoinChat(connection, params) elif command == "addbuddy": account = findaccount(accountname, protocol) - return cgaim.GaimBlistRequestAddBuddy(account, params["screenname"], + return cpurple.PurpleBlistRequestAddBuddy(account, params["screenname"], params.get("group", ""), "") elif command == "setstatus": - current = gaim.GaimSavedstatusGetCurrent() + current = purple.PurpleSavedstatusGetCurrent() if "status" in params: status_id = params["status"] - status_type = gaim.GaimPrimitiveGetTypeFromId(status_id) + status_type = purple.PurplePrimitiveGetTypeFromId(status_id) else: - status_type = gaim.GaimSavedstatusGetType(current) - status_id = gaim.GaimPrimitiveGetIdFromType(status_type) + status_type = purple.PurpleSavedstatusGetType(current) + status_id = purple.PurplePrimitiveGetIdFromType(status_type) if "message" in params: message = params["message"]; else: - message = gaim.GaimSavedstatusGetMessage(current) + message = purple.PurpleSavedstatusGetMessage(current) if "account" in params: - accounts = [cgaim.GaimAccountsFindAny(accountname, protocol)] + accounts = [cpurple.PurpleAccountsFindAny(accountname, protocol)] for account in accounts: - status = gaim.GaimAccountGetStatus(account, status_id) - type = gaim.GaimStatusGetType(status) - gaim.GaimSavedstatusSetSubstatus(current, account, type, message) - gaim.GaimSavedstatusActivateForAccount(current, account) + status = purple.PurpleAccountGetStatus(account, status_id) + type = purple.PurpleStatusGetType(status) + purple.PurpleSavedstatusSetSubstatus(current, account, type, message) + purple.PurpleSavedstatusActivateForAccount(current, account) else: - accounts = gaim.GaimAccountsGetAllActive() - saved = gaim.GaimSavedstatusNew("", status_type) - gaim.GaimSavedstatusSetMessage(saved, message) - gaim.GaimSavedstatusActivate(saved) + accounts = purple.PurpleAccountsGetAllActive() + saved = purple.PurpleSavedstatusNew("", status_type) + purple.PurpleSavedstatusSetMessage(saved, message) + purple.PurpleSavedstatusActivate(saved) return None elif command == "getinfo": account = findaccount(accountname, protocol) - connection = cgaim.GaimAccountGetConnection(account) - return gaim.ServGetInfo(connection, params["screenname"]) + connection = cpurple.PurpleAccountGetConnection(account) + return purple.ServGetInfo(connection, params["screenname"]) elif command == "quit": - return gaim.GaimCoreQuit() + return purple.PurpleCoreQuit() elif command == "uri": return None @@ -180,7 +180,7 @@ fargs = [] for arg in args: fargs.append(convert(arg.strip())) - return gaim.__getattr__(name)(*fargs) + return purple.__getattr__(name)(*fargs) else: # introspect the object to get parameter names and types # this is slow because the entire introspection info must be downloaded @@ -200,7 +200,7 @@ methodparams.append(int(value)) else: raise "Don't know how to handle type \"%s\"" % type - return gaim.__getattr__(command)(*methodparams) + return purple.__getattr__(command)(*methodparams) show_help() raise "Unknown command: %s" % command diff -r 74b2d576f458 -r 598b1b15b199 libpurple/purple-send --- a/libpurple/purple-send Sun Apr 15 18:06:49 2007 +0000 +++ b/libpurple/purple-send Sun Apr 15 18:09:14 2007 +0000 @@ -5,8 +5,8 @@ if test -z "$METHOD_NAME" then cat <