Changeset 2563
- Timestamp:
- 02/07/06 00:51:00
- Files:
-
- branches/galago-daemon/protocol-cleanup/ChangeLog (modified) (1 diff)
- branches/galago-daemon/protocol-cleanup/src/presence.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/galago-daemon/protocol-cleanup/ChangeLog
r2561 r2563 1 Tue Feb 07 00:50:39 PST 2006 Christian Hammond <chipx86@chipx86.com> 2 3 * src/presence.c: 4 - When a status is added, compute the object path and send it back 5 to the caller. 6 1 7 Mon Feb 06 01:10:05 PST 2006 Christian Hammond <chipx86@chipx86.com> 2 8 branches/galago-daemon/protocol-cleanup/src/presence.c
r2528 r2563 23 23 #include "utils.h" 24 24 25 static char * 26 galagod_status_generate_path(GalagoPresence *presence, GalagoStatus *status) 27 { 28 return g_strdup_printf("%s/%s", 29 galago_object_get_dbus_path(GALAGO_OBJECT(presence)), 30 galago_status_get_id(status)); 31 } 32 25 33 static void 26 34 _galagod_dbus_presence_emit_status_added(GalagoPresence *presence, … … 72 80 { 73 81 GalagoStatus *status; 74 GalagodMetaPresence *meta_presence ;82 GalagodMetaPresence *meta_presence = GALAGOD_META_PRESENCE(presence); 75 83 GalagoPresence *main_presence; 76 84 DBusMessageIter iter; 85 DBusMessage *reply; 77 86 const GList* l; 78 87 const char *status_id; 79 88 int status_weight = 0; 80 81 meta_presence = GALAGOD_META_PRESENCE(presence); 89 char *obj_path; 82 90 83 91 dbus_message_iter_init(message, &iter); 84 92 status = galago_dbus_message_iter_get_object(&iter, GALAGO_TYPE_STATUS); 85 dbus_message_iter_next(&iter); 86 93 94 /* Pull out the status ID and object path, and set it back on the status */ 87 95 status_id = galago_status_get_id(status); 96 obj_path = galagod_status_generate_path(presence, status); 97 galago_object_set_dbus_path(GALAGO_OBJECT(status), obj_path); 98 99 /* Send the reply containing the object path. */ 100 reply = dbus_message_new_method_return(message); 101 dbus_message_iter_init_append(reply, &iter); 102 dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &obj_path); 103 dbus_connection_send(dbus_conn, reply, NULL); 104 dbus_message_unref(reply); 105 g_free(obj_path); 88 106 89 107 if (!galago_presence_has_status(presence, status_id)) 90 galago_presence_add_status(presence, galago_status_duplicate(status)); 108 { 109 GalagoStatus *dup_status = galago_status_duplicate(status); 110 111 obj_path = galagod_status_generate_path(presence, dup_status); 112 galago_object_set_dbus_path(GALAGO_OBJECT(dup_status), obj_path); 113 g_free(obj_path); 114 galago_presence_add_status(presence, dup_status); 115 } 91 116 92 117 for (l = galagod_meta_presence_get_presences(meta_presence); … … 104 129 main_presence = galagod_meta_presence_get_presence(meta_presence); 105 130 106 if (status_weight > 0) 107 { 108 if (!galago_presence_has_status(main_presence, status_id)) 109 { 110 galago_context_push(galagod_get_context()); 111 112 galago_presence_add_status(main_presence, 113 galago_status_duplicate(status)); 114 115 galago_context_pop(); 116 117 _galagod_dbus_presence_emit_status_added(main_presence, status); 118 } 131 if (status_weight > 0 && 132 !galago_presence_has_status(main_presence, status_id)) 133 { 134 GalagoStatus *dup_status; 135 136 galago_context_push(galagod_get_context()); 137 dup_status = galago_status_duplicate(status); 138 obj_path = galagod_status_generate_path(main_presence, dup_status); 139 galago_object_set_dbus_path(GALAGO_OBJECT(dup_status), obj_path); 140 g_free(obj_path); 141 galago_presence_add_status(main_presence, dup_status); 142 galago_context_pop(); 143 144 _galagod_dbus_presence_emit_status_added(main_presence, status); 119 145 } 120 146 121 147 g_object_unref(status); 122 123 galagod_dbus_send_empty_reply(dbus_conn, message);124 148 125 149 return DBUS_HANDLER_RESULT_HANDLED;
