diff options
author | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2009-12-30 19:07:58 +0000 |
---|---|---|
committer | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2009-12-30 19:07:58 +0000 |
commit | dc30c9a81abef063f080c7e1ff1a9719b7a59e3a (patch) | |
tree | 2cd3a553219af9db38e87c733211b34e2235cbae /src | |
parent | 87a30fdddcbc41d88b5937de33c2e4be7d0f33ad (diff) | |
download | telepathy-logger-dc30c9a81abef063f080c7e1ff1a9719b7a59e3a.tar.gz |
proto DBus service, .service and .client installed
* prototype of DBus service, called telepathy-logger-dbus
* Automake amending for dbus-binding-tool, .service and .cliet TP files
Diffstat (limited to 'src')
-rw-r--r-- | src/HeadlessLogger.client | 12 | ||||
-rw-r--r-- | src/Makefile.am | 119 | ||||
-rw-r--r-- | src/libtelepathy-logger.pc.in | 11 | ||||
-rw-r--r-- | src/org.freedesktop.Telepathy.Client.TelepathyLogger.client | 3 | ||||
-rw-r--r-- | src/org.freedesktop.Telepathy.Client.TelepathyLogger.service.in | 3 | ||||
-rw-r--r-- | src/org.freedesktop.Telepathy.TelepathyLoggerService.service.in | 3 | ||||
-rw-r--r-- | src/telepathy-logger-dbus.c | 67 | ||||
-rw-r--r-- | src/telepathy-logger-dbus.h | 5 | ||||
-rw-r--r-- | src/test_api.c | 7 | ||||
-rw-r--r-- | src/tpl-dbus-service.c | 111 | ||||
-rw-r--r-- | src/tpl-dbus-service.h | 59 | ||||
-rw-r--r-- | src/tpl-dbus-service.xml | 14 | ||||
-rw-r--r-- | src/tpl-headless-logger-init.c | 4 | ||||
-rw-r--r-- | src/tpl-log-entry.c | 18 | ||||
-rw-r--r-- | src/tpl-observer.c | 6 | ||||
-rw-r--r-- | src/tpl-observer.h | 4 | ||||
-rw-r--r-- | src/tpl-text-channel-context.c | 28 |
17 files changed, 378 insertions, 96 deletions
diff --git a/src/HeadlessLogger.client b/src/HeadlessLogger.client deleted file mode 100644 index c700635..0000000 --- a/src/HeadlessLogger.client +++ /dev/null @@ -1,12 +0,0 @@ -[org.freedesktop.Telepathy.Client] -Interfaces=org.freedesktop.Telepathy.Client.Observer; - -[org.freedesktop.Telepathy.Client.Observer.ObserverChannelFilter 0] -org.freedesktop.Telepathy.Channel.Type s=org.freedesktop.Telepathy.Channel.Type.Text -org.freedesktop.Telepathy.Channel.TargetHandleType u=1 -org.freedesktop.Telepathy.Channel.Requested b=true - -[org.freedesktop.Telepathy.Client.Observer.ObserverChannelFilter 1] -org.freedesktop.Telepathy.Channel.Type s=org.freedesktop.Telepathy.Channel.Type.Text -org.freedesktop.Telepathy.Channel.TargetHandleType u=2 -org.freedesktop.Telepathy.Channel.Requested b=true diff --git a/src/Makefile.am b/src/Makefile.am index b6fb21d..286dcac 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,14 +11,36 @@ AM_CPPFLAGS = \ $(DISABLE_DEPRECATED) \ $(WARN_CFLAGS) -LDADD = $(TPL_LIBS) \ - $(LIBTPL_LIBS) +#LDADD = $(TPL_LIBS) \ +# $(LIBTPL_LIBS) + +BUILT_SOURCES = \ + tpl-dbus-service-server.h \ + tpl-dbus-service-client.h + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libtelepathy-logger.pc lib_LTLIBRARIES = libtelepathy-logger.la +LIBTPLdir = $(includedir)/telepathy-logger +LIBTPL_HEADERS = \ + tpl-channel.h \ + tpl-contact.h \ + tpl-log-entry.h \ + tpl-log-entry-text.h \ + tpl-log-manager.h \ + tpl-log-manager-priv.h \ + tpl-log-store-empathy.h \ + tpl-log-store.h \ + tpl-observer.h \ + tpl-text-channel-context.h \ + tpl-time.h \ + tpl-utils.h + + libtelepathy_logger_la_SOURCES = \ tpl-observer.c \ - tpl-headless-logger-init.c \ tpl-channel.c \ tpl-text-channel-context.c \ tpl-log-entry.c \ @@ -30,76 +52,44 @@ libtelepathy_logger_la_SOURCES = \ tpl-utils.c \ tpl-time.c -include_HEADERS = \ - tpl-channel.h \ - tpl-contact.h \ - tpl-log-entry.h \ - tpl-log-entry-text.h \ - tpl-log-manager.h \ - tpl-log-manager-priv.h \ - tpl-log-store-empathy.h \ - tpl-log-store.h \ - tpl-observer.h \ - tpl-text-channel-context.h \ - tpl-time.h \ - tpl-utils.h - - bin_PROGRAMS = \ - telepathy-logger \ + telepathy-logger-dbus \ + telepathy-logger \ test-api -#BUILT_SOURCES= - +telepathy_logger_dbus_SOURCES = \ + tpl-dbus-service.c \ + telepathy-logger-dbus.c +telepathy_logger_dbus_LDADD = libtelepathy-logger.la $(TPL_LIBS) test_api_SOURCES = test_api.c test_api_LDADD = libtelepathy-logger.la $(LIBTPL_LIBS) - -telepathy_logger_SOURCES = telepathy-logger.c +telepathy_logger_SOURCES = \ + tpl-headless-logger-init.c \ + telepathy-logger.c telepathy_logger_LDADD = libtelepathy-logger.la $(TPL_LIBS) nodist_telepathy_logger_SOURCES = $(BUILT_SOURCES) check_c_sources = \ - $(telepathy_logger_handwritten_source) \ - $(telepathy_logger_logs_SOURCES) + $(libtelepathy_logger_la_SOURCES) \ + $(test_api_SOURCES) \ + $(telepathy_logger_SOURCES) \ + $(telepathy_logger_dbus_SOURCES) include $(top_srcdir)/tools/check-coding-style.mk check-local: check-coding-style -#DISABLED#uidir = $(datadir)/telepathy-logger -#DISABLED#ui_DATA = \ -#DISABLED# empathy-accounts-dialog.ui \ -#DISABLED# empathy-call-window-fullscreen.ui \ -#DISABLED# empathy-call-window.ui \ -#DISABLED# empathy-chat-window.ui \ -#DISABLED# empathy-chatrooms-window.ui \ -#DISABLED# empathy-ft-manager.ui \ -#DISABLED# empathy-import-dialog.ui \ -#DISABLED# empathy-main-window.ui \ -#DISABLED# empathy-new-chatroom-dialog.ui \ -#DISABLED# empathy-preferences.ui \ -#DISABLED# empathy-status-icon.ui - -EXTRA_DIST = \ - $(autostart_DATA) \ - $(ui_DATA) - -#DISABLED#if HAVE_LIBCHAMPLAIN -#DISABLED#empathy_handwritten_source += \ -#DISABLED# empathy-map-view.c \ -#DISABLED# empathy-map-view.h -#DISABLED# -#DISABLED#ui_DATA += \ -#DISABLED# empathy-map-view.ui -#DISABLED#else -#DISABLED#EXTRA_DIST += \ -#DISABLED# empathy-map-view.c \ -#DISABLED# empathy-map-view.h \ -#DISABLED# empathy-map-view.ui -#DISABLED#endif - -dist_man_MANS = +EXTRA_DIST = \ + tpl-dbus-service.xml + +#Rule to generate the binding headers +tpl-dbus-service-server.h: tpl-dbus-service.xml + dbus-binding-tool --prefix=tpl_dbus_service --mode=glib-server $<> $@ + +tpl-dbus-service-client.h: tpl-dbus-service.xml + dbus-binding-tool --prefix=tpl_dbus_service --mode=glib-client $<> $@ + # rules for making the glib enum objects %-enumtypes.h: %.h Makefile.in @@ -120,3 +110,16 @@ dist_man_MANS = $< > $@ CLEANFILES = $(BUILT_SOURCES) + +# Dbus service file +servicedir = $(DBUS_SERVICES_DIR) +service_in_files = \ + org.freedesktop.Telepathy.TelepathyLoggerService.service.in \ + org.freedesktop.Telepathy.Client.TelepathyLogger.service.in +service_DATA = \ + $(service_in_files:.service.in=.service) \ + org.freedesktop.Telepathy.Client.TelepathyLogger.client + +# Rule to make the service file with bindir expanded +$(service_DATA): $(service_in_files) Makefile + @sed -e "s|%bindir%|$(bindir)|" $<> $@ diff --git a/src/libtelepathy-logger.pc.in b/src/libtelepathy-logger.pc.in new file mode 100644 index 0000000..c11a59f --- /dev/null +++ b/src/libtelepathy-logger.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@/telepathy-logger + +Name: something +Description: Telepathy Logger library +Requires: telepathy-glib libxml-2.0 +Version: @VERSION@ +Libs: -L${libdir} -llibtelepathy-logger +Cflags: -I${includedir} diff --git a/src/org.freedesktop.Telepathy.Client.TelepathyLogger.client b/src/org.freedesktop.Telepathy.Client.TelepathyLogger.client new file mode 100644 index 0000000..21e6792 --- /dev/null +++ b/src/org.freedesktop.Telepathy.Client.TelepathyLogger.client @@ -0,0 +1,3 @@ +[DBus Service] +Name=org.freedesktop.Telepathy.Client.TelepathyLoggerDBusService +Exec=/usr/local/bin/telepathy-logger-dbus diff --git a/src/org.freedesktop.Telepathy.Client.TelepathyLogger.service.in b/src/org.freedesktop.Telepathy.Client.TelepathyLogger.service.in new file mode 100644 index 0000000..5b95f92 --- /dev/null +++ b/src/org.freedesktop.Telepathy.Client.TelepathyLogger.service.in @@ -0,0 +1,3 @@ +[DBus Service] +Name=org.freedesktop.Telepathy.Client.TelepathyLogger +Exec=%bindir%/telepathy-logger diff --git a/src/org.freedesktop.Telepathy.TelepathyLoggerService.service.in b/src/org.freedesktop.Telepathy.TelepathyLoggerService.service.in new file mode 100644 index 0000000..adab198 --- /dev/null +++ b/src/org.freedesktop.Telepathy.TelepathyLoggerService.service.in @@ -0,0 +1,3 @@ +[DBus Service] +Name=org.freedesktop.Telepathy.Client.TelepathyLoggerDBusService +Exec=%bindir%/telepathy-logger-dbus diff --git a/src/telepathy-logger-dbus.c b/src/telepathy-logger-dbus.c new file mode 100644 index 0000000..6691b0b --- /dev/null +++ b/src/telepathy-logger-dbus.c @@ -0,0 +1,67 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2009 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> + */ + +#include <glib.h> + +#include <telepathy-glib/dbus.h> + +#include <telepathy-logger-dbus.h> +#include <tpl-dbus-service.h> + +static GMainLoop *loop = NULL; + +void telepathy_logger_dbus_init(void) +{ + TplDBusService *dbus_srv; + DBusGConnection *bus; + TpDBusDaemon *tp_bus; + GError *error = NULL; + + bus = tp_get_bus(); + tp_bus = tp_dbus_daemon_new(bus); + + if ( tp_dbus_daemon_request_name (tp_bus, TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME, + TRUE, &error) ) { + g_print("%s DBus well known name registered\n", + TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME); + } else { + g_print("Well Known name request error: %s\n", error->message); + g_clear_error(&error); + g_error_free(error); + } + + dbus_srv = tpl_dbus_service_new (); + dbus_g_connection_register_g_object (bus, + TPL_DBUS_SRV_OBJECT_PATH, + G_OBJECT(dbus_srv)); +} + +int main(int argc, char *argv[]) +{ + g_type_init (); + + telepathy_logger_dbus_init (); + + loop = g_main_loop_new (NULL, FALSE); + g_main_loop_run (loop); + + return 0; +} diff --git a/src/telepathy-logger-dbus.h b/src/telepathy-logger-dbus.h new file mode 100644 index 0000000..1ce1e37 --- /dev/null +++ b/src/telepathy-logger-dbus.h @@ -0,0 +1,5 @@ +#ifndef __TELEPATHY_LOGGER_DBUS_H__ + +void telepathy_logger_dbus_init (void); + +#endif // __TELEPATHY_LOGGER_DBUS_H__ diff --git a/src/test_api.c b/src/test_api.c index 71161b1..a2ae44f 100644 --- a/src/test_api.c +++ b/src/test_api.c @@ -36,6 +36,7 @@ int main(int argc, char *argv[]) //DBusGConnection *bus; TpDBusDaemon *tp_bus; GError *err=NULL; + GList *lst; g_type_init (); //tpl_headless_logger_init (); @@ -53,8 +54,12 @@ int main(int argc, char *argv[]) manager = tpl_log_manager_dup_singleton (); - tpl_log_manager_search_in_identifier_chats_new(manager, + lst = tpl_log_manager_search_in_identifier_chats_new(manager, acc, "echo@test.collabora.co.uk", "foo"); + for(;lst;lst=g_list_next(lst)) { + TplLogSearchHit *hit = lst->data; + g_message("HIT %s\n", hit->chat_id); + } tpl_log_manager_search_new(manager, "foo"); diff --git a/src/tpl-dbus-service.c b/src/tpl-dbus-service.c new file mode 100644 index 0000000..f5af6cb --- /dev/null +++ b/src/tpl-dbus-service.c @@ -0,0 +1,111 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2009 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> + */ + +#include <glib.h> + +#include <telepathy-glib/dbus.h> +#include <telepathy-glib/account.h> + +#include <tpl-dbus-service.h> + +static gboolean +tpl_dbus_service_last_messages (TplDBusService *self, + gchar const* account_path, gchar const* identifier, + gboolean is_chatroom, gint lines, gchar **str_ret); + +#include <tpl-dbus-service-server.h> + +G_DEFINE_TYPE (TplDBusService, tpl_dbus_service, G_TYPE_OBJECT) + + +static gboolean +tpl_dbus_service_last_messages (TplDBusService *self, + gchar const* account_path, gchar const* identifier, + gboolean is_chatroom, gint lines, gchar **str_ret) +{ + TpAccount *account; + DBusGConnection *dbus; + TpDBusDaemon *tp_dbus; + GError *error=NULL; + + g_message("TPL DBUS A: %s %s\n", account_path, identifier); + + dbus = tp_get_bus(); + tp_dbus = tp_dbus_daemon_new(dbus); + + account = tp_account_new(tp_dbus, account_path, &error); + if (error!=NULL) { + g_error("during TpAccount creation: %s\n", + error->message); + g_object_unref(tp_dbus); + return FALSE; + } + + str_ret = NULL; + return TRUE; +} + + + + +static void +tpl_dbus_service_finalize (GObject *obj) +{ + G_OBJECT_CLASS (tpl_dbus_service_parent_class)->dispose (obj); +} + +static void +tpl_dbus_service_dispose (GObject *obj) +{ + //TplDBusService *self = TPL_DBUS_SERVICE(obj); + + g_debug("TplDBusService: disposing\n"); + + G_OBJECT_CLASS (tpl_dbus_service_parent_class)->finalize (obj); + + g_debug("TplDBusService: disposed\n"); +} + + +static void +tpl_dbus_service_class_init(TplDBusServiceClass* klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS (klass); + object_class->finalize = tpl_dbus_service_finalize; + object_class->dispose = tpl_dbus_service_dispose; + + dbus_g_object_type_install_info (TPL_TYPE_DBUS_SERVICE, + &dbus_glib_tpl_dbus_service_object_info); + +} + +static void +tpl_dbus_service_init(TplDBusService* self) +{ +} + + +TplDBusService *tpl_dbus_service_new (void) +{ + return g_object_new(TPL_TYPE_DBUS_SERVICE, NULL); +} + + diff --git a/src/tpl-dbus-service.h b/src/tpl-dbus-service.h new file mode 100644 index 0000000..7e08c51 --- /dev/null +++ b/src/tpl-dbus-service.h @@ -0,0 +1,59 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2009 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> + */ + +#ifndef __TPL_DBUS_SERVICE_H__ +#define __TPL_DBUS_SERVICE_H__ + +#define TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME \ + "org.freedesktop.Telepathy..TelepathyLoggerService" +#define TPL_DBUS_SRV_OBJECT_PATH \ + "/org/freedesktop/Telepathy/TelepathyLoggerService" + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define TPL_TYPE_DBUS_SERVICE (tpl_dbus_service_get_type ()) +#define TPL_DBUS_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPL_TYPE_DBUS_SERVICE, TplDBusService)) +#define TPL_DBUS_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPL_TYPE_DBUS_SERVICE, TplDBusServiceClass)) +#define TPL_IS_DBUS_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPL_TYPE_DBUS_SERVICE)) +#define TPL_IS_DBUS_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPL_TYPE_DBUS_SERVICE)) +#define TPL_DBUS_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_DBUS_SERVICE, TplDBusServiceClass)) + + +typedef struct { + GObject parent; + + /* Private */ +} TplDBusService; + +typedef struct { + GObjectClass parent_class; +} TplDBusServiceClass; + +GType tpl_dbus_service_get_type (void); + +TplDBusService *tpl_dbus_service_new (void); + + +G_END_DECLS + +#endif // __TPL_DBUS_SERVICE_H__ diff --git a/src/tpl-dbus-service.xml b/src/tpl-dbus-service.xml new file mode 100644 index 0000000..f801041 --- /dev/null +++ b/src/tpl-dbus-service.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<node name="/org/freedesktop/Telepathy/Client/TelepathyLoggerDBusService"> + <interface name="org.freedesktop.Telepathy.Client.TelepathyLoggerDBusService"> + <annotation name="org.freedesktop.DBus.GLib.Asyn" value=""/> + <method name="LastMessages"> + <arg type="o" name="account" direction="in" /> + <arg type="s" name="identifier" direction="in" /> + <arg type="b" name="is_chatroom" direction="in" /> + <arg type="i" name="lines" direction="in" /> + <arg type="as" name="str_ret" direction="out" /> + </method> + </interface> +</node> + diff --git a/src/tpl-headless-logger-init.c b/src/tpl-headless-logger-init.c index e522508..7ac5a79 100644 --- a/src/tpl-headless-logger-init.c +++ b/src/tpl-headless-logger-init.c @@ -46,7 +46,8 @@ void tpl_headless_logger_init(void) if ( tp_dbus_daemon_request_name (tp_bus, TPL_OBSERVER_WELL_KNOWN_BUS_NAME, TRUE, &error) ) { - g_print("Well Known name requested successfully!\n"); + g_print("%s DBus well known name registered\n", + TPL_OBSERVER_WELL_KNOWN_BUS_NAME); } else { g_print("Well Known name request error: %s\n", error->message); g_clear_error(&error); @@ -54,6 +55,7 @@ void tpl_headless_logger_init(void) } + observer = tpl_observer_new (); dbus_g_connection_register_g_object (bus, TPL_OBSERVER_OBJECT_PATH, diff --git a/src/tpl-log-entry.c b/src/tpl-log-entry.c index 583c9b4..097cf06 100644 --- a/src/tpl-log-entry.c +++ b/src/tpl-log-entry.c @@ -26,10 +26,12 @@ G_DEFINE_TYPE (TplLogEntry, tpl_log_entry, G_TYPE_OBJECT) -static void tpl_log_entry_finalize (GObject *obj) +static void +tpl_log_entry_finalize (GObject *obj) {} -static void tpl_log_entry_dispose (GObject *obj) +static void +tpl_log_entry_dispose (GObject *obj) { TplLogEntry *self = TPL_LOG_ENTRY(obj); @@ -44,19 +46,22 @@ static void tpl_log_entry_dispose (GObject *obj) } -static void tpl_log_entry_class_init(TplLogEntryClass* klass) +static void +tpl_log_entry_class_init(TplLogEntryClass* klass) { GObjectClass* object_class = G_OBJECT_CLASS (klass); object_class->finalize = tpl_log_entry_finalize; object_class->dispose = tpl_log_entry_dispose; } -static void tpl_log_entry_init(TplLogEntry* self) +static void +tpl_log_entry_init(TplLogEntry* self) { } -void tpl_log_entry_set_entry(TplLogEntry *self, void* entry) +void +tpl_log_entry_set_entry(TplLogEntry *self, void* entry) { g_return_if_fail(TPL_IS_LOG_ENTRY(self)); g_return_if_fail(self->entry.generic==NULL); @@ -69,7 +74,8 @@ void tpl_log_entry_set_entry(TplLogEntry *self, void* entry) } } -TplLogEntryType tpl_log_entry_get_entry_type(TplLogEntry *self) +TplLogEntryType +tpl_log_entry_get_entry_type(TplLogEntry *self) { g_return_val_if_fail(TPL_IS_LOG_ENTRY(self), TPL_LOG_ENTRY_ERROR); diff --git a/src/tpl-observer.c b/src/tpl-observer.c index c94d51c..3e94704 100644 --- a/src/tpl-observer.c +++ b/src/tpl-observer.c @@ -318,10 +318,8 @@ observer_iface_init (gpointer g_iface, gpointer iface_data) { TpSvcClientObserverClass *klass = (TpSvcClientObserverClass *) g_iface; -#define IMPLEMENT(x) tp_svc_client_observer_implement_##x (klass, \ - tpl_observer_##x) - IMPLEMENT (observe_channels); -#undef IMPLEMENT + tp_svc_client_observer_implement_observe_channels (klass, + tpl_observer_observe_channels); } static void diff --git a/src/tpl-observer.h b/src/tpl-observer.h index 06ff92d..7daf4c9 100644 --- a/src/tpl-observer.h +++ b/src/tpl-observer.h @@ -27,9 +27,9 @@ #define TP_IFACE_CHAN_TEXT "org.freedesktop.Telepathy.Channel.Type.Text" #define TPL_OBSERVER_WELL_KNOWN_BUS_NAME \ - "org.freedesktop.Telepathy.Client.HeadlessLogger" + "org.freedesktop.Telepathy.Client.TelepathyLogger" #define TPL_OBSERVER_OBJECT_PATH \ - "/org/freedesktop/Telepathy/Client/HeadlessLogger" + "/org/freedesktop/Telepathy/Client/TelepathyLogger" G_BEGIN_DECLS diff --git a/src/tpl-text-channel-context.c b/src/tpl-text-channel-context.c index 5e60054..6b96196 100644 --- a/src/tpl-text-channel-context.c +++ b/src/tpl-text-channel-context.c @@ -71,8 +71,8 @@ _channel_on_lost_message_cb (TpChannel *proxy, gpointer user_data, GObject *weak_object) { - g_debug("lost message signal catched"); - // log that the system lost a message + g_debug("lost message signal catched. nothing logged\n"); + // TODO log that the system lost a message } static void @@ -84,8 +84,9 @@ _channel_on_send_error_cb (TpChannel *proxy, gpointer user_data, GObject *weak_object) { - g_error("unable to send the message: %s", arg_Text); - // log that the system was unable to send the message + g_error("unlogged event: " + "TP was unable to send the message: %s.\n", arg_Text); + // TODO log that the system was unable to send the message } @@ -279,10 +280,12 @@ _channel_on_received_signal_cb (TpChannel *proxy, TplLogEntry *log; TplLogEntryText *tlog; + g_message("ID: %d\n", arg_ID); + // TODO use the Message iface to check the delivery // notification and handle it correctly if(arg_Flags & TP_CHANNEL_TEXT_MESSAGE_FLAG_NON_TEXT_CONTENT) { - g_debug("Non text contenct flag set." + g_debug("Non text content flag set." "Probably a delivery notification for a sent message." "Ignoring\n"); return; @@ -308,8 +311,6 @@ _channel_on_received_signal_cb (TpChannel *proxy, tpl_log_entry_set_timestamp(log, (time_t) arg_Timestamp); - g_debug("remote handler: %d\n", arg_Sender); - tp_connection_get_contacts_by_handle( tpl_channel_get_connection(tpl_chan), 1, &remote_handle, @@ -415,7 +416,6 @@ _tpl_text_channel_get_chatroom_cb (TpConnection *proxy, error->message); } - g_debug("SETTING CHATROOM ID: %s\n", *out_Identifiers); tpl_text_channel_set_chatroom_id(tpl_text, *out_Identifiers); context_continue(tpl_text); @@ -630,16 +630,20 @@ tpl_text_channel_new(TplChannel* tpl_channel) /* follows unhandled TpHandleType */ case TP_HANDLE_TYPE_NONE: - g_debug("remote handle: TP_HANDLE_TYPE_NONE: un-handled\n"); + g_warning ("remote handle: TP_HANDLE_TYPE_NONE: " + "un-handled. It's probably OK.\n"); break; case TP_HANDLE_TYPE_LIST: - g_debug("remote handle: TP_HANDLE_TYPE_LIST: un-handled\n"); + g_warning ("remote handle: TP_HANDLE_TYPE_LIST: \n" + "un-handled. It's probably OK.\n"); break; case TP_HANDLE_TYPE_GROUP: - g_debug("remote handle: TP_HANDLE_TYPE_GROUP: un-handled\n"); + g_warning ("remote handle: TP_HANDLE_TYPE_GROUP: " + "un-handled. It's probably OK.\n"); break; default: - g_error("remote handle unknown\n"); + g_error ("remote handle type unknown %d.\n", + remote_handle_type); break; } |