diff options
32 files changed, 427 insertions, 145 deletions
@@ -22,6 +22,7 @@ shave shave-libtool libtool stamp-h1 +gtk-doc.make config.* *~ @@ -38,15 +39,32 @@ config.* src/telepathy-logger src/test-api -src/telepathy-logger-dbus -src/dbus-service-client.h -src/dbus-service-server.h data/*.service data/*.client +telepathy-logger/dbus-service-client.h +telepathy-logger/dbus-service-server.h telepathy-logger/libtelepathy-logger.pc extensions/_gen/ extensions/extensions.html tests/test-*[^ch] +tests/twisted/telepathy-logger-debug +tests/twisted/tools/org.freedesktop.Telepathy.Client.TelepathyLogger.service + +doc/reference/libtelepathy-logger/*.stamp +doc/reference/libtelepathy-logger/html/ +doc/reference/libtelepathy-logger/tmpl/ +doc/reference/libtelepathy-logger/xml/ +doc/reference/libtelepathy-logger/telepathy-logger-*.txt +doc/reference/libtelepathy-logger/telepathy-logger-*.bak +doc/reference/libtelepathy-logger/telepathy-logger-*.sgml +doc/reference/libtelepathy-logger/telepathy-logger.args +doc/reference/libtelepathy-logger/telepathy-logger.hierarchy +doc/reference/libtelepathy-logger/telepathy-logger.interfaces +doc/reference/libtelepathy-logger/telepathy-logger.prerequisites +doc/reference/libtelepathy-logger/telepathy-logger.signals +doc/reference/libtelepathy-logger/telepathy-logger.types + + diff --git a/Makefile.am b/Makefile.am index 4e07192..15a8471 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,9 @@ -SUBDIRS = tools telepathy-logger data src tests +SUBDIRS = tools telepathy-logger data src tests doc ACLOCAL_AMFLAGS = -I m4 DISTCHECK_CONFIGURE_FLAGS = \ + --enable-gtk-doc \ --disable-scrollkeeper \ --disable-schemas-install diff --git a/configure.ac b/configure.ac index 3a6a29d..810a480 100644 --- a/configure.ac +++ b/configure.ac @@ -66,6 +66,9 @@ AM_GCONF_SOURCE_2 GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal` AC_SUBST(GLIB_GENMARSHAL) + +GTK_DOC_CHECK([1.10]) + # ----------------------------------------------------------- # Check for code generation tools # ----------------------------------------------------------- @@ -215,6 +218,9 @@ SHAVE_INIT(.) AC_OUTPUT([ Makefile data/Makefile + doc/Makefile + doc/reference/Makefile + doc/reference/libtelepathy-logger/Makefile src/Makefile telepathy-logger/Makefile telepathy-logger/libtelepathy-logger.pc diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..f3ddc22 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = reference diff --git a/doc/README b/doc/README deleted file mode 100644 index 1413a1e..0000000 --- a/doc/README +++ /dev/null @@ -1,2 +0,0 @@ -There is almost nothing here, for more informations look at -http://telepathy.freedesktop.org/wiki/Logger diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am new file mode 100644 index 0000000..84b5d8b --- /dev/null +++ b/doc/reference/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = libtelepathy-logger diff --git a/doc/reference/libtelepathy-logger/Makefile.am b/doc/reference/libtelepathy-logger/Makefile.am new file mode 100644 index 0000000..57063d0 --- /dev/null +++ b/doc/reference/libtelepathy-logger/Makefile.am @@ -0,0 +1,99 @@ +## Process this file with automake to produce Makefile.in + +abs_top_builddir = @abs_top_builddir@ + +# We require automake 1.6 at least. +AUTOMAKE_OPTIONS = 1.6 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=telepathy-logger + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR=${top_srcdir}/telepathy-logger + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS= + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS=--deprecated-guards=TP_DISABLE_DEPRECATED + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS= + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=$(top_srcdir)/telepathy-logger/*.h +CFILE_GLOB=$(top_srcdir)/telepathy-logger/*.c + +# Header files to ignore when scanning. +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +IGNORE_HFILES= \ + dbus-service-client.h + dbus-service-server.h + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES= + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files= + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files= + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +INCLUDES= \ + -I$(top_srcdir) -I$(top_builddir) \ + $(LIBTPL_CFLAGS) +GTKDOC_LIBS= \ + $(LIBTPL_LIBS) \ + $(top_builddir)/telepathy-logger/libtelepathy-logger.la + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +include $(top_srcdir)/gtk-doc.make + +if ENABLE_GTK_DOC +check-local: + @if grep '^0 symbols incomplete' \ + $(srcdir)/telepathy-logger-undocumented.txt; then\ + :; else \ + cat $(srcdir)/telepathy-logger-undocumented.txt; exit 1; fi + @if grep '^0 not documented' \ + $(srcdir)/telepathy-logger-undocumented.txt; then\ + :; else \ + cat $(srcdir)/telepathy-logger-undocumented.txt; exit 1; fi + @if grep . $(srcdir)/telepathy-logger-unused.txt; then\ + echo "^^^ Unused symbols" >&2; exit 1; fi + @if test -e $(srcdir)/telepathy-logger-undeclared.txt &&\ + grep . $(srcdir)/telepathy-logger-undeclared.txt; then\ + echo "^^^ Undeclared symbols" >&2; exit 1; fi +endif diff --git a/telepathy-logger/Makefile.am b/telepathy-logger/Makefile.am index 73629f4..02c972f 100644 --- a/telepathy-logger/Makefile.am +++ b/telepathy-logger/Makefile.am @@ -8,6 +8,10 @@ AM_CPPFLAGS = \ $(DISABLE_DEPRECATED) \ $(WARN_CFLAGS) +BUILT_SOURCES = \ + dbus-service-server.h \ + dbus-service-client.h + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libtelepathy-logger.pc @@ -15,23 +19,28 @@ lib_LTLIBRARIES = libtelepathy-logger.la LIBTPLdir = $(includedir)/telepathy-logger LIBTPL_HEADERS = \ - util.h \ contact.h \ + channel.h \ + channel-text.h \ + datetime.h \ + dbus-service.h \ + dbus-service-client.h \ log-entry.h \ log-entry-text.h \ log-manager.h \ log-store.h \ log-store-empathy.h \ - datetime.h + util.h libtelepathy_logger_la_SOURCES = \ - datetime.c \ channel.c \ channel-factory.c \ channel-text.c \ conf.c \ contact.c \ + datetime.c \ + dbus-service.c \ log-entry.c \ log-entry-text.c \ log-manager.c \ @@ -47,3 +56,11 @@ include $(top_srcdir)/tools/check-coding-style.mk check-local: check-coding-style CLEANFILES = $(BUILT_SOURCES) + +#Rule to generate the binding headers +dbus-service-server.h: $(top_srcdir)/data/dbus-service.xml + dbus-binding-tool --prefix=tpl_dbus_service --mode=glib-server $< > $@ + +dbus-service-client.h: $(top_srcdir)/data/dbus-service.xml + dbus-binding-tool --prefix=tpl_dbus_service --mode=glib-client $< > $@ + diff --git a/telepathy-logger/channel-text.c b/telepathy-logger/channel-text.c index a4e8d13..792f9fc 100644 --- a/telepathy-logger/channel-text.c +++ b/telepathy-logger/channel-text.c @@ -299,10 +299,12 @@ tpl_channel_text_init (TplChannelText *self) /** + * tpl_channel_text_new * @conn: TpConnection instance owning the channel * @object_path: the channel's DBus path * @tp_chan_props: channel's immutable properties, obtained for example by * %tp_channel_borrow_immutable_properties() + * @account: TpAccount instance, related to the new #TplChannelText * @error: location of the GError, used in case a problem is raised while * creating the channel * @@ -937,8 +939,8 @@ on_received_signal_cb (TpChannel *proxy, return; } - /* Initialize TplLogEntryText (part 1) */ - log = tpl_log_entry_text_new (arg_Timestamp, NULL, + /* Initialize TplLogEntryText (part 1) - chat_id still unknown */ + log = tpl_log_entry_text_new (arg_ID, NULL, TPL_LOG_ENTRY_DIRECTION_IN); tpl_log_entry_text_set_tpl_channel_text (log, tpl_text); diff --git a/telepathy-logger/channel-text.h b/telepathy-logger/channel-text.h index 5b287c9..0208b51 100644 --- a/telepathy-logger/channel-text.h +++ b/telepathy-logger/channel-text.h @@ -31,11 +31,8 @@ #include <telepathy-glib/channel.h> #include <telepathy-glib/connection.h> #include <telepathy-glib/contact.h> -#include <telepathy-glib/svc-client.h> #include <telepathy-logger/channel.h> -#include <telepathy-logger/observer.h> -#include <telepathy-logger/util.h> G_BEGIN_DECLS #define TPL_TYPE_CHANNEL_TEXT (tpl_channel_text_get_type ()) diff --git a/telepathy-logger/channel.c b/telepathy-logger/channel.c index 6a66e1b..0302314 100644 --- a/telepathy-logger/channel.c +++ b/telepathy-logger/channel.c @@ -20,6 +20,7 @@ */ #include "channel.h" +#include "observer.h" #include <string.h> @@ -124,6 +125,11 @@ tpl_channel_class_init (TplChannelClass *klass) klass->call_when_ready_protected = call_when_ready_protected; + /** + * TplObserver:account: + * + * the TpAccount instance associated with TplChannel + */ param_spec = g_param_spec_object ("account", "Account", "TpAccount instance associated with TplChannel", TP_TYPE_ACCOUNT, G_PARAM_READABLE | G_PARAM_WRITABLE | @@ -170,11 +176,19 @@ tpl_channel_set_account (TplChannel *self, /** - * It has to be called by all the child classes in order to prepare all the - * objects involved in the logging process. + * tpl_channel_call_when_ready + * @self: a TplChannel instance + * @cb: a callback + * @user_data: user's data passed to the callback * - * It internally calls _call_when_ready for TpAccount TpConnection and - * TpChannel itself. When everything is ready calls the user passed callback. + * The TplObserver has no idea of what TplChannel subclass intance it's + * dealing with. + * In order to prepare the subclass instance this method has to + * be called, which will call #TplChannelClass.call_when_ready + * virtual method, implemented (mandatory) by #TplChannel subclasses. + * Such method has to call, internally, + * #TplChannelClass.call_when_ready_protected in order to prepare also the + * #TplChannel instance. */ void tpl_channel_call_when_ready (TplChannel *self, GAsyncReadyCallback cb, @@ -188,6 +202,17 @@ void tpl_channel_call_when_ready (TplChannel *self, } +/** + * call_when_ready_protected + * @self: a TplChannel instance + * @cb: a callback + * @user_data: user's data passed to the callback + * + * This static method is called from #TplChannelClass.call_when_ready, implemented by + * #TplChannel subclasses. + * + * See also: tpl_channel_call_when_ready() + */ static void call_when_ready_protected (TplChannel *self, GAsyncReadyCallback cb, diff --git a/telepathy-logger/conf.c b/telepathy-logger/conf.c index f487ef0..5af9161 100644 --- a/telepathy-logger/conf.c +++ b/telepathy-logger/conf.c @@ -126,7 +126,7 @@ tpl_conf_get_gconf_client (TplConf *self) { * Convenience function to obtain a TPL Configuration object, which is a * singleton. * - * Returns a TplConf signleton instance with its reference counter + * Returns: a TplConf signleton instance with its reference counter * incremented. Remember to unref the counter. */ TplConf * @@ -144,9 +144,9 @@ tpl_conf_dup (void) * * Wether TPL is globally enabled or not. If it's not globally enabled, no * signals will be logged at all. - * To enable/disable a single account use #tpl_conf_set_accounts_ignorelist + * To enable/disable a single account use tpl_conf_set_accounts_ignorelist() * - * Returns %TRUE if TPL logging is globally enable, otherwise returns %FALSE + * Returns: %TRUE if TPL logging is globally enable, otherwise returns %FALSE * and @error will be used. */ gboolean @@ -157,22 +157,22 @@ tpl_conf_is_globally_enabled (TplConf *self, GError *loc_error = NULL; if (!TPL_IS_CONF (self)) - { - g_set_error_literal (error, TPL_CONF_ERROR, TPL_CONF_ERROR_GCONF_KEY, - "arg1 passed to tpl_conf_is_globally_enabled is not TplConf instance"); - return FALSE; - } + { + g_set_error_literal (error, TPL_CONF_ERROR, TPL_CONF_ERROR_GCONF_KEY, + "arg1 passed to tpl_conf_is_globally_enabled is not TplConf instance"); + return FALSE; + } ret = gconf_client_get_bool (GET_PRIV (self)->client, GCONF_KEY_LOGGING_TURNED_ON, &loc_error); if (loc_error != NULL) - { + { g_debug ("Accessing " GCONF_KEY_LOGGING_TURNED_ON ": %s", loc_error->message); g_propagate_error (error, loc_error); g_error_free (loc_error); return FALSE; - } + } return ret; } @@ -212,14 +212,14 @@ tpl_conf_globally_enable (TplConf *self, * times the schema+APIs will match and no error will be raised. */ if (loc_error != NULL) - { + { g_error ("Probably the Telepathy-Logger GConf's schema has changed " "and you're using an out of date library\n"); g_propagate_error (error, loc_error); g_clear_error (&loc_error); g_error_free (loc_error); return; - } + } } @@ -233,7 +233,7 @@ tpl_conf_globally_enable (TplConf *self, * The list of ignored accounts. If an account is ignored, no signals for this * account will be logged. * - * Returns a GList of (gchar*) contaning ignored accounts' object paths or + * Returns: a GList of (gchar*) contaning ignored accounts' object paths or * %NULL with @error set otherwise. */ GSList * @@ -262,7 +262,7 @@ tpl_conf_get_accounts_ignorelist (TplConf *self, /** - * tpl_conf_get_accounts_ignorelist + * tpl_conf_set_accounts_ignorelist * @self: a TplConf instance * @newlist: a new GList containing account's object paths (gchar*) to be ignored * @error: memory adress where to store a GError, in case of error, or %NULL @@ -296,14 +296,14 @@ tpl_conf_set_accounts_ignorelist (TplConf *self, * the schema+APIs will match and no error will be raised. */ if (loc_error != NULL) - { + { g_error ("Probably the Telepathy-Logger GConf's schema has changed " "and you're using an out of date library\n"); g_propagate_error (error, loc_error); g_clear_error (&loc_error); g_error_free (loc_error); return; - } + } } @@ -316,7 +316,7 @@ tpl_conf_set_accounts_ignorelist (TplConf *self, * * Wether @account_path is enabled or disable (aka ignored). * - * Returns %TRUE if @account_path is ignored, %FALSE if it's not or %FALSE + * Returns: %TRUE if @account_path is ignored, %FALSE if it's not or %FALSE * and @error set if an error occurs. */ gboolean diff --git a/telepathy-logger/contact.c b/telepathy-logger/contact.c index cadf9b6..7d1980c 100644 --- a/telepathy-logger/contact.c +++ b/telepathy-logger/contact.c @@ -154,6 +154,11 @@ static void tpl_contact_class_init (TplContactClass *klass) object_class->get_property = tpl_contact_get_prop; object_class->set_property = tpl_contact_set_prop; + /** + * TplContact:identifier: + * + * The contact's identifier + */ param_spec = g_param_spec_string ("identifier", "Identifier", "The contact's identifier", @@ -161,6 +166,11 @@ static void tpl_contact_class_init (TplContactClass *klass) G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_IDENTIFIER, param_spec); + /** + * TplContact:alias: + * + * The contact's alias + */ param_spec = g_param_spec_string ("alias", "Alias", "The contact's alias", @@ -168,6 +178,11 @@ static void tpl_contact_class_init (TplContactClass *klass) G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_ALIAS, param_spec); + /** + * TplContact:presence-status: + * + * The contact's presence status string + */ param_spec = g_param_spec_string ("presence-status", "PresenceStatus", "The contact's presence status string", @@ -175,6 +190,11 @@ static void tpl_contact_class_init (TplContactClass *klass) G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_ALIAS, param_spec); + /** + * TplContact:presence-message: + * + * The contact's presence message string + */ param_spec = g_param_spec_string ("presence-message", "PresenceMessage", "The contact's presence message", @@ -182,6 +202,11 @@ static void tpl_contact_class_init (TplContactClass *klass) G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_ALIAS, param_spec); + /** + * TplContact:avatar-token: + * + * The contact's avatar token + */ param_spec = g_param_spec_string ("avatar-token", "AvatarToken", "The contact's avatar's token", diff --git a/telepathy-logger/contact.h b/telepathy-logger/contact.h index b1c4f5e..ab9fc06 100644 --- a/telepathy-logger/contact.h +++ b/telepathy-logger/contact.h @@ -1,22 +1,22 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 2009 Collabora Ltd. + *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 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. + *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 + *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> + *Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> */ #ifndef __TPL_CONTACT_H__ @@ -33,7 +33,8 @@ G_BEGIN_DECLS #define TPL_IS_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPL_TYPE_CONTACT)) #define TPL_IS_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPL_TYPE_CONTACT)) #define TPL_CONTACT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_CONTACT, TplContactClass)) - typedef enum + +typedef enum { TPL_CONTACT_UNKNOWN, TPL_CONTACT_USER, @@ -45,7 +46,7 @@ typedef struct { GObject parent; - /* Private */ + /*Private */ TplContactPriv *priv; } TplContact; @@ -58,42 +59,26 @@ typedef struct GType tpl_contact_get_type (void); -TplContact *tpl_contact_from_tp_contact (TpContact * contact); - +TplContact *tpl_contact_from_tp_contact (TpContact *contact); TplContact *tpl_contact_new (const gchar *identifier); -TpContact *tpl_contact_get_contact (TplContact * self); - -const gchar *tpl_contact_get_alias (TplContact * self); - -const gchar *tpl_contact_get_identifier (TplContact * self); - -const gchar *tpl_contact_get_presence_status (TplContact * self); - -const gchar *tpl_contact_get_presence_message (TplContact * self); - -TplContactType tpl_contact_get_contact_type (TplContact * self); - -const gchar * tpl_contact_get_avatar_token (TplContact * self); - -TpAccount *tpl_contact_get_account (TplContact * self); - -void tpl_contact_set_contact (TplContact * self, TpContact * data); - -void tpl_contact_set_account (TplContact * self, TpAccount * data); - -void tpl_contact_set_alias (TplContact * self, const gchar * data); - -void tpl_contact_set_identifier (TplContact * self, const gchar * data); - -void tpl_contact_set_presence_status (TplContact * self, const gchar * data); - -void tpl_contact_set_presence_message (TplContact * self, const gchar * data); - -void tpl_contact_set_contact_type (TplContact * self, TplContactType data); - -void tpl_contact_set_avatar_token (TplContact * self, const gchar *data); - +TpContact *tpl_contact_get_contact (TplContact *self); +const gchar *tpl_contact_get_alias (TplContact *self); +const gchar *tpl_contact_get_identifier (TplContact *self); +const gchar *tpl_contact_get_presence_status (TplContact *self); +const gchar *tpl_contact_get_presence_message (TplContact *self); +TplContactType tpl_contact_get_contact_type (TplContact *self); +const gchar *tpl_contact_get_avatar_token (TplContact *self); +TpAccount *tpl_contact_get_account (TplContact *self); + +void tpl_contact_set_contact (TplContact *self, TpContact *data); +void tpl_contact_set_account (TplContact *self, TpAccount *data); +void tpl_contact_set_alias (TplContact *self, const gchar *data); +void tpl_contact_set_identifier (TplContact *self, const gchar *data); +void tpl_contact_set_presence_status (TplContact *self, const gchar *data); +void tpl_contact_set_presence_message (TplContact *self, const gchar *data); +void tpl_contact_set_contact_type (TplContact *self, TplContactType data); +void tpl_contact_set_avatar_token (TplContact *self, const gchar *data); G_END_DECLS #endif // __TPL_CONTACT_H__ diff --git a/telepathy-logger/log-entry-text.c b/telepathy-logger/log-entry-text.c index 89c678a..cdb160a 100644 --- a/telepathy-logger/log-entry-text.c +++ b/telepathy-logger/log-entry-text.c @@ -21,6 +21,7 @@ #include "log-entry-text.h" +#include <glib-object.h> #include <telepathy-glib/util.h> #include <telepathy-logger/util.h> diff --git a/telepathy-logger/log-entry-text.h b/telepathy-logger/log-entry-text.h index 6d9ff48..3070427 100644 --- a/telepathy-logger/log-entry-text.h +++ b/telepathy-logger/log-entry-text.h @@ -23,10 +23,8 @@ #define __TPL_LOG_ENTRY_TEXT_H__ #include <glib-object.h> -#include <telepathy-glib/enums.h> #include <telepathy-logger/channel-text.h> -#include <telepathy-logger/contact.h> #include <telepathy-logger/log-entry.h> G_BEGIN_DECLS diff --git a/telepathy-logger/log-entry.c b/telepathy-logger/log-entry.c index 6b0eedb..b77637c 100644 --- a/telepathy-logger/log-entry.c +++ b/telepathy-logger/log-entry.c @@ -28,15 +28,13 @@ #include <telepathy-logger/util.h> /** - * SECTION:LogEntry + * SECTION:log-entry * @title: TplLogEntry * @short_description: Abstract representation of a log entry * @see_also: #TplLogEntryText and other subclasses when they'll exist * - * The TPLogger log entry abstract representation. This class is supposed to - * be subclassed by a class representing a specific type of log (i.e., Text - * chat, Call, etc). - * + * The TPLogger log entry represent a generic log entry, which will be + * specialied by subclasses of #TplLogEntry. */ G_DEFINE_ABSTRACT_TYPE (TplLogEntry, tpl_log_entry, G_TYPE_OBJECT) diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c index 59ce15d..004326e 100644 --- a/telepathy-logger/log-manager.c +++ b/telepathy-logger/log-manager.c @@ -181,9 +181,10 @@ tpl_log_manager_dup_singleton (void) * tpl_log_manager_add_message * @manager: the log manager * @message: a TplLogEntry subclass's instance + * @error: the memory location of GError, filled if an error occurs * * It stores @message, sending it to all the registered TplLogStore which have - * the "writable" property set to %TRUE. + * #TplLogStore:writable set to %TRUE. * Every TplLogManager is guaranteed to have at least TplLogStore a readable * and a writable LogStore regitered. * @@ -234,19 +235,18 @@ tpl_log_manager_add_message (TplLogManager *manager, /** * tpl_log_manager_register_logstore - * @manager: the log manager + * @self: the log manager * @logstore: a TplLogStore interface implementation * * It registers @logstore into @manager, the log store has to be an * implementation of the TplLogStore interface. * * @logstore has to properly implement the add_message method if the - * "writable" propertly is set to %TRUE. + * #TplLogStore:writable is set to %TRUE. * * @logstore has to properly implement all the search/query methods if the - * "readable" propertly is set to %TRUE. + * #TplLogStore:readable is set to %TRUE. */ - void tpl_log_manager_register_logstore (TplLogManager *self, TplLogStore *logstore) diff --git a/telepathy-logger/log-store-empathy.c b/telepathy-logger/log-store-empathy.c index e784b9c..9857480 100644 --- a/telepathy-logger/log-store-empathy.c +++ b/telepathy-logger/log-store-empathy.c @@ -206,6 +206,13 @@ tpl_log_store_empathy_class_init (TplLogStoreEmpathyClass *klass) object_class->get_property = get_prop; object_class->set_property = set_prop; + /** + * TplLogStoreEmpathy:name: + * + * The log store's name. No default available, it has to be passed at object + * creation. + * As defined in #TplLogStore. + */ param_spec = g_param_spec_string ("name", "Name", "The TplLogStore implementation's name", @@ -218,6 +225,12 @@ tpl_log_store_empathy_class_init (TplLogStoreEmpathyClass *klass) * it's set to NULL and let to get_basedir to set it to its default if * priv->basedir == NULL */ + + /** + * TplLogStoreEmpathy:basedir: + * + * The log store's basedir. + */ param_spec = g_param_spec_string ("basedir", "Basedir", "The TplLogStore implementation's name", @@ -225,6 +238,13 @@ tpl_log_store_empathy_class_init (TplLogStoreEmpathyClass *klass) G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_BASEDIR, param_spec); + /** + * TplLogStoreEmpathy:readable: + * + * Wether the log store is readable. + * Default: %TRUE + * As defined in #TplLogStore. + */ param_spec = g_param_spec_boolean ("readable", "Readable", "Defines wether the LogStore is readable or not, allowing searching " @@ -233,6 +253,13 @@ tpl_log_store_empathy_class_init (TplLogStoreEmpathyClass *klass) G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_READABLE, param_spec); + /** + * TplLogStoreEmpathy:writable: + * + * Wether the log store is writable. + * Default: %FALSE + * As defined in #TplLogStore. + */ param_spec = g_param_spec_boolean ("writable", "Writable", "Defines wether the LogStore is writable or not, allowing message " diff --git a/telepathy-logger/log-store-empathy.h b/telepathy-logger/log-store-empathy.h index d099371..b78c0df 100644 --- a/telepathy-logger/log-store-empathy.h +++ b/telepathy-logger/log-store-empathy.h @@ -29,7 +29,6 @@ #include <glib-object.h> G_BEGIN_DECLS -#define TPL_LOG_STORE_EMPATHY_LOGFILE_REGEX "\\d{8}.log" #define TPL_TYPE_LOG_STORE_EMPATHY \ (tpl_log_store_empathy_get_type ()) #define TPL_LOG_STORE_EMPATHY(obj) \ @@ -45,19 +44,17 @@ G_BEGIN_DECLS #define TPL_LOG_STORE_EMPATHY_GET_CLASS(inst) \ (G_TYPE_INSTANCE_GET_CLASS ((inst), TPL_TYPE_LOG_STORE_EMPATHY, \ TplLogStoreEmpathyClass)) -typedef struct _TplLogStoreEmpathy TplLogStoreEmpathy; -typedef struct _TplLogStoreEmpathyClass TplLogStoreEmpathyClass; -struct _TplLogStoreEmpathy +typedef struct TplLogStoreEmpathy { GObject parent; gpointer priv; -}; +} TplLogStoreEmpathy; -struct _TplLogStoreEmpathyClass +typedef struct { GObjectClass parent; -}; +} TplLogStoreEmpathyClass; GType tpl_log_store_empathy_get_type (void); diff --git a/telepathy-logger/log-store.c b/telepathy-logger/log-store.c index 872d661..e2de7c1 100644 --- a/telepathy-logger/log-store.c +++ b/telepathy-logger/log-store.c @@ -23,6 +23,39 @@ #include "log-store.h" +/** + * SECTION:log-store + * @title: TplLogStore + * @short_description: LogStore interface can register into #TplLogManager as + * #TplLogStore:writable or #TplLogStore:readable log stores. + * @see_also: #log-entry-text:TplLogEntryText and other subclasses when they'll exist + * + * The #TplLogStore defines all the public methods that a TPL Log Store has to + * implement in order to be used into a #TplLogManager. + */ + +/** + * TplLogStore:writable: + * + * Defines wether the object is writable for a #TplLogManager. + * + * If an TplLogStore implementation is writable, the #TplLogManager will call + * it's tpl_log_store_add_message() method every time a loggable even occurs, + * i.e., everytime tpl_log_manager_add_message() is called. + */ + +/** + * TplLogStore:readable: + * + * Defines wether the object is readable for a #TplLogManager. + * + * If an TplLogStore implementation is readable, the #TplLogManager will + * use the query methods against the instance (i.e., tpl_log_store_get_dates()) + * every time a #TplLogManager instance is queried (i.e., + * tpl_log_manager_get_date()). + */ + + GType tpl_log_store_get_type (void) { @@ -48,7 +81,7 @@ tpl_log_store_get_type (void) const gchar * -tpl_log_store_get_name (TplLogStore * self) +tpl_log_store_get_name (TplLogStore *self) { if (!TPL_LOG_STORE_GET_INTERFACE (self)->get_name) return NULL; diff --git a/telepathy-logger/log-store.h b/telepathy-logger/log-store.h index 12231fa..70e4b07 100644 --- a/telepathy-logger/log-store.h +++ b/telepathy-logger/log-store.h @@ -40,12 +40,10 @@ G_BEGIN_DECLS (inst), TPL_TYPE_LOG_STORE, TplLogStoreInterface)) typedef struct _TplLogStore TplLogStore; /*dummy object */ -typedef struct _TplLogStoreInterface TplLogStoreInterface; typedef gboolean (*TplLogMessageFilter) (TplLogEntry *message, gpointer user_data); - -struct _TplLogStoreInterface +typedef struct { GTypeInterface parent; @@ -74,7 +72,7 @@ struct _TplLogStoreInterface GList * (*get_filtered_messages) (TplLogStore *self, TpAccount *account, const gchar *chat_id, gboolean chatroom, guint num_messages, TplLogMessageFilter filter, gpointer user_data); -}; +} TplLogStoreInterface; GType tpl_log_store_get_type (void); diff --git a/telepathy-logger/observer.c b/telepathy-logger/observer.c index 4ed145d..743c988 100644 --- a/telepathy-logger/observer.c +++ b/telepathy-logger/observer.c @@ -359,8 +359,6 @@ tpl_observer_class_init (TplObserverClass *klass) * TplObserver:interfaces: * * Interfaces implemented by this object. - * - * Since: 0.1.0 */ g_object_class_install_property (object_class, PROP_INTERFACES, g_param_spec_boxed ("interfaces", "Interfaces", @@ -372,8 +370,6 @@ tpl_observer_class_init (TplObserverClass *klass) * * Channels that this object will accept and manage from the Channel * Dispatcher - * - * Since: 0.1.0 */ g_object_class_install_property (object_class, PROP_CHANNEL_FILTER, g_param_spec_boxed ("channel-filter", @@ -389,8 +385,6 @@ tpl_observer_class_init (TplObserverClass *klass) * One can receive change notifications on this property by connecting * to the #GObject::notify signal and using this property as the signal * detail. - * - * Since: 0.1.0 */ g_object_class_install_property (object_class, PROP_REGISTERED_CHANNELS, g_param_spec_boxed ("registered-channels", diff --git a/tests/Makefile.am b/tests/Makefile.am index 48e34b7..1ddabb1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,6 +4,10 @@ endif SUBDIRS = $(CHECKTWISTED) suppressions +LDADD = \ + $(top_builddir)/telepathy-logger/libtelepathy-logger.la \ + $(LIBTPL_LIBS) + noinst_PROGRAMS = \ test-tpl-channel \ test-tpl-conf \ @@ -15,9 +19,10 @@ test_tpl_channel_SOURCES = \ test-tpl-channel.c \ tpl-channel-test.c -LDADD = \ - $(top_builddir)/telepathy-logger/libtelepathy-logger.la \ - $(LIBTPL_LIBS) +test_tpl_observer_SOURCES = \ + test-tpl-observer.c \ + tpl-channel-test.c + AM_CFLAGS = $(ERROR_CFLAGS) $(LIBTPL_CFLAGS) \ -I $(top_srcdir)/telepathy-logger -I $(top_builddir)/src @@ -36,8 +41,7 @@ check-valgrind: $(TESTS) --show-reachable=no \ --gen-suppressions=all \ --num-callers=20 \ - --suppressions=@abs_top_srcdir@/tests/suppressions/gabble.supp \ - --suppressions=@abs_top_srcdir@/tests/suppressions/tp-glib.supp \ + --suppressions=@abs_top_srcdir@/tests/suppressions/tpl.supp \ --error-exitcode=1" \ check-TESTS diff --git a/tests/suppressions/tpl.supp b/tests/suppressions/tpl.supp index 18d0dac..9398da9 100644 --- a/tests/suppressions/tpl.supp +++ b/tests/suppressions/tpl.supp @@ -1,5 +1,20 @@ # Valgrind error suppression file + +# ============================= selinux ================================== + +{ + selinux getdelim + Memcheck:Leak + fun:malloc + fun:getdelim + obj:/lib/libselinux.so.1 + obj:/lib/libselinux.so.1 + obj:/lib/libselinux.so.1 +} + + + # ============================= libc ================================== { diff --git a/tests/test-searches.c b/tests/test-searches.c index e6ca943..ea784f7 100644 --- a/tests/test-searches.c +++ b/tests/test-searches.c @@ -54,4 +54,6 @@ main (int argc, char *argv[]) loc->next->data) != 0); g_list_foreach (ret, (GFunc) tpl_log_manager_search_hit_free, NULL); g_list_free (ret); + + } diff --git a/tests/test-tpl-channel.c b/tests/test-tpl-channel.c index b4c5314..6ebb429 100644 --- a/tests/test-tpl-channel.c +++ b/tests/test-tpl-channel.c @@ -2,8 +2,6 @@ #include <telepathy-logger/conf.h> -#define gconf_client_get_bool(obj,key,err) g_print ("%s", key) - #define CONNECTION_PATH "org.freedesktop.Telepathy.Connection.gabble.jabber.cosimo_2ealfarano_40collabora_2eco_2euk_2fKazoo" #define ACCOUNT_PATH "/org/freedesktop/Telepathy/Account/FOO/BAR/BAZ" #define CHANNEL_PATH "/BAZ" @@ -60,6 +58,5 @@ int main (int argc, char **argv) } */ - g_debug ("FOO"); return 0; } diff --git a/tests/test-tpl-conf.c b/tests/test-tpl-conf.c index f9d3e6b..132c13c 100644 --- a/tests/test-tpl-conf.c +++ b/tests/test-tpl-conf.c @@ -23,7 +23,6 @@ main (int argc, char **argv) /* proper disposal for the singleton when no references are present */ g_object_unref (conf); - g_assert (TPL_IS_CONF (conf) == FALSE); return 0; } diff --git a/tests/test-tpl-observer.c b/tests/test-tpl-observer.c index e9f70b5..b57576b 100644 --- a/tests/test-tpl-observer.c +++ b/tests/test-tpl-observer.c @@ -1,7 +1,8 @@ +#include "tpl-channel-test.h" + #include <telepathy-logger/channel-factory.h> #include <telepathy-logger/observer.h> - static gint factory_counter = 0; static TplChannel * @@ -19,6 +20,7 @@ int main (int argc, char **argv) { TplObserver *obs, *obs2; + TplChannel *chan; g_type_init (); @@ -40,6 +42,11 @@ main (int argc, char **argv) /* register a ChanFactory and test ObserveChannel() */ tpl_observer_set_channel_factory (obs, mock_factory); + + /* register a channel */ + chan = TPL_CHANNEL (tpl_channel_test_new (NULL, NULL, NULL, NULL, NULL)); + tpl_observer_register_channel (obs, chan); + /* proper disposal for the singleton when no references are present */ g_object_unref (obs); g_assert (TPL_IS_OBSERVER (obs) == FALSE); diff --git a/tests/tpl-channel-test.c b/tests/tpl-channel-test.c index 65b4d34..bc9f1c0 100644 --- a/tests/tpl-channel-test.c +++ b/tests/tpl-channel-test.c @@ -98,7 +98,6 @@ tpl_channel_test_init (TplChannelTest *self) * * Returns: the TplChannelTest instance or %NULL in @object_path is not valid */ - TplChannelTest * tpl_channel_test_new (TpConnection *conn, const gchar *object_path, @@ -106,28 +105,8 @@ tpl_channel_test_new (TpConnection *conn, TpAccount *account, GError **error) { - TpProxy *conn_proxy = TP_PROXY (conn); - - /* Do what tpl_channel_new does + set TplChannelTest specific properties */ - - g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL); - g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL); - g_return_val_if_fail (!TPL_STR_EMPTY (object_path), NULL); - g_return_val_if_fail (tp_chan_props != NULL, NULL); - - if (!tp_dbus_check_valid_object_path (object_path, error)) - return NULL; - return g_object_new (TPL_TYPE_CHANNEL_TEST, - /* TplChannel properties */ "account", account, - /* TpChannel properties */ - "connection", conn, - "dbus-daemon", conn_proxy->dbus_daemon, - "bus-name", conn_proxy->bus_name, - "object-path", object_path, - "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE, - "channel-properties", tp_chan_props, NULL); } diff --git a/tests/twisted/tools/exec-with-log.sh b/tests/twisted/tools/exec-with-log.sh new file mode 100755 index 0000000..fef4d54 --- /dev/null +++ b/tests/twisted/tools/exec-with-log.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +cd "/home/kalfa/src/telepathy-logger/tests/twisted/tools" + +export TPL_DEBUG=all +ulimit -c unlimited +exec >> tpl-testing.log 2>&1 + +if test -n "$TPL_TEST_VALGRIND"; then + export G_DEBUG=${G_DEBUG:+"${G_DEBUG},"}gc-friendly + export G_SLICE=always-malloc + export DBUS_DISABLE_MEM_POOLS=1 + TPL_WRAPPER="valgrind --leak-check=full --num-callers=20" + TPL_WRAPPER="$TPL_WRAPPER --show-reachable=yes" + TPL_WRAPPER="$TPL_WRAPPER --gen-suppressions=all" + TPL_WRAPPER="$TPL_WRAPPER --child-silent-after-fork=yes" + TPL_WRAPPER="$TPL_WRAPPER --suppressions=/home/kalfa/src/telepathy-logger/tests/suppressions/tp-glib.supp" + TPL_WRAPPER="$TPL_WRAPPER --suppressions=/home/kalfa/src/telepathy-logger/tests/suppressions/tpl.supp" +elif test -n "$TPL_TEST_REFDBG"; then + if test -z "$REFDBG_OPTIONS" ; then + export REFDBG_OPTIONS="btnum=10" + fi + if test -z "$TPL_WRAPPER" ; then + TPL_WRAPPER="refdbg" + fi +elif test -n "$TPL_TEST_STRACE"; then + TPL_WRAPPER="strace -o strace.log" +fi + +export G_DEBUG=fatal-warnings,fatal-criticals" ${G_DEBUG}" +exec /home/kalfa/src/telepathy-logger/libtool --mode=execute $TPL_WRAPPER ../telepathy-tpl-debug diff --git a/tests/twisted/tools/tmp-session-bus.conf b/tests/twisted/tools/tmp-session-bus.conf new file mode 100644 index 0000000..df4f0c4 --- /dev/null +++ b/tests/twisted/tools/tmp-session-bus.conf @@ -0,0 +1,27 @@ +<!-- This configuration file controls the per-user-login-session message bus. + Add a session-local.conf and edit that rather than changing this + file directly. --> + +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<busconfig> + <!-- Our well-known bus type, don't change this --> + <type>session</type> + + <listen>unix:tmpdir=/tmp</listen> + + <servicedir>/home/kalfa/src/telepathy-logger/tests/twisted/tools</servicedir> + + <policy context="default"> + <!-- Allow everything to be sent --> + <allow send_destination="*" eavesdrop="true"/> + <!-- Allow everything to be received --> + <allow eavesdrop="true"/> + <!-- Allow anyone to own anything --> + <allow own="*"/> + </policy> + + <!-- This is included last so local configuration can override what's + in this standard file --> + +</busconfig> |