From 92fe674be3a9b3d0d18a9018e52fcfe5eca7732e Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 7 Jun 2010 16:24:37 +0200 Subject: rename TplLogEntryText to TplEntryText and TplLogEntry to TplEntry --- telepathy-logger/channel-text.c | 110 +++++++------- telepathy-logger/dbus-service.c | 10 +- telepathy-logger/entry-internal.h | 86 +++++------ telepathy-logger/entry-text-internal.h | 64 ++++----- telepathy-logger/entry-text.c | 120 ++++++++-------- telepathy-logger/entry-text.h | 28 ++-- telepathy-logger/entry.c | 246 ++++++++++++++++---------------- telepathy-logger/entry.h | 36 ++--- telepathy-logger/log-manager-internal.h | 4 +- telepathy-logger/log-manager.c | 36 ++--- telepathy-logger/log-manager.h | 2 +- telepathy-logger/log-store-internal.h | 4 +- telepathy-logger/log-store-sqlite.c | 68 ++++----- telepathy-logger/log-store-xml.c | 98 ++++++------- telepathy-logger/log-store.c | 10 +- tests/test-tpl-log-entry.c | 6 +- tests/test-tpl-log-manager.c | 2 +- 17 files changed, 465 insertions(+), 465 deletions(-) diff --git a/telepathy-logger/channel-text.c b/telepathy-logger/channel-text.c index c1f877349..c9f91ba9a 100644 --- a/telepathy-logger/channel-text.c +++ b/telepathy-logger/channel-text.c @@ -105,7 +105,7 @@ static void pendingproc_get_remote_handle_type (TplActionChain *ctx, static void pendingproc_cleanup_pending_messages_db (TplActionChain *ctx, gpointer user_data); -static void keepon_on_receiving_signal (TplLogEntryText *log); +static void keepon_on_receiving_signal (TplEntryText *log); static void got_message_pending_messages_cb (TpProxy *proxy, const GValue *out_Value, const GError *error, gpointer user_data, GObject *weak_object); @@ -715,7 +715,7 @@ got_message_pending_messages_cb (TpProxy *proxy, { DEBUG ("pending-message-id not in a valid range, setting to " "UNKNOWN"); - message_id = TPL_LOG_ENTRY_MSG_ID_UNKNOWN; + message_id = TPL_ENTRY_MSG_ID_UNKNOWN; } message_timestamp = tp_asv_get_uint64 (message_headers, "message-received", NULL); @@ -1115,8 +1115,8 @@ on_sent_signal_cb (TpChannel *proxy, TpContact *me; TplContact *tpl_contact_sender; TplContact *tpl_contact_receiver = NULL; - TplLogEntryText *text_log; - TplLogEntry *log; + TplEntryText *text_log; + TplEntry *log; TplLogManager *logmanager; const gchar *chat_id; const gchar *account_path; @@ -1127,7 +1127,7 @@ on_sent_signal_cb (TpChannel *proxy, channel_path = tp_proxy_get_object_path (TP_PROXY (tpl_text)); log_id = _tpl_create_message_token (channel_path, arg_Timestamp, - TPL_LOG_ENTRY_MSG_ID_ACKNOWLEDGED); + TPL_ENTRY_MSG_ID_ACKNOWLEDGED); /* Initialize data for TplContact */ me = _tpl_channel_text_get_my_contact (tpl_text); @@ -1162,7 +1162,7 @@ on_sent_signal_cb (TpChannel *proxy, arg_Text); } - /* Initialise TplLogEntryText */ + /* Initialise TplEntryText */ if (!_tpl_channel_text_is_chatroom (tpl_text)) chat_id = tpl_contact_get_identifier (tpl_contact_receiver); else @@ -1171,30 +1171,30 @@ on_sent_signal_cb (TpChannel *proxy, account_path = tp_proxy_get_object_path ( TP_PROXY (_tpl_channel_get_account (TPL_CHANNEL (tpl_text)))); - text_log = _tpl_log_entry_text_new (log_id, account_path, - TPL_LOG_ENTRY_DIRECTION_OUT); - log = TPL_LOG_ENTRY (text_log); - - _tpl_log_entry_set_pending_msg_id (TPL_LOG_ENTRY (log), - TPL_LOG_ENTRY_MSG_ID_ACKNOWLEDGED); - _tpl_log_entry_set_channel_path (TPL_LOG_ENTRY (log), channel_path); - _tpl_log_entry_set_chat_id (log, chat_id); - _tpl_log_entry_set_timestamp (log, (time_t) arg_Timestamp); - _tpl_log_entry_set_signal_type (log, TPL_LOG_ENTRY_TEXT_SIGNAL_SENT); - _tpl_log_entry_set_sender (log, tpl_contact_sender); + text_log = _tpl_entry_text_new (log_id, account_path, + TPL_ENTRY_DIRECTION_OUT); + log = TPL_ENTRY (text_log); + + _tpl_entry_set_pending_msg_id (TPL_ENTRY (log), + TPL_ENTRY_MSG_ID_ACKNOWLEDGED); + _tpl_entry_set_channel_path (TPL_ENTRY (log), channel_path); + _tpl_entry_set_chat_id (log, chat_id); + _tpl_entry_set_timestamp (log, (time_t) arg_Timestamp); + _tpl_entry_set_signal_type (log, TPL_ENTRY_TEXT_SIGNAL_SENT); + _tpl_entry_set_sender (log, tpl_contact_sender); /* NULL when it's a chatroom */ if (tpl_contact_receiver != NULL) - _tpl_log_entry_set_receiver (log, tpl_contact_receiver); - _tpl_log_entry_text_set_message (text_log, arg_Text); - _tpl_log_entry_text_set_message_type (text_log, arg_Type); - _tpl_log_entry_text_set_tpl_channel_text (text_log, tpl_text); + _tpl_entry_set_receiver (log, tpl_contact_receiver); + _tpl_entry_text_set_message (text_log, arg_Text); + _tpl_entry_text_set_message_type (text_log, arg_Type); + _tpl_entry_text_set_tpl_channel_text (text_log, tpl_text); /* Initialized LogStore and send the log entry */ - _tpl_log_entry_text_set_chatroom (text_log, + _tpl_entry_text_set_chatroom (text_log, _tpl_channel_text_is_chatroom (tpl_text)); logmanager = tpl_log_manager_dup_singleton (); - _tpl_log_manager_add_message (logmanager, TPL_LOG_ENTRY (log), &error); + _tpl_log_manager_add_message (logmanager, TPL_ENTRY (log), &error); if (error != NULL) { @@ -1215,7 +1215,7 @@ on_sent_signal_cb (TpChannel *proxy, /* the only function of this CB is resolving the remote TpHandle, in case * cannot be known at preparation time (ie on chatrooms channels) * - * It sets gets a TplLogEntryText as weak_ref and sets the sender for it */ + * It sets gets a TplEntryText as weak_ref and sets the sender for it */ static void on_received_signal_with_contact_cb (TpConnection *connection, guint n_contacts, @@ -1226,20 +1226,20 @@ on_received_signal_with_contact_cb (TpConnection *connection, gpointer user_data, GObject *weak_object) { - TplLogEntryText *log = TPL_LOG_ENTRY_TEXT (weak_object); + TplEntryText *log = TPL_ENTRY_TEXT (weak_object); TplChannelText *tpl_text; TpContact *remote; - g_return_if_fail (TPL_IS_LOG_ENTRY_TEXT (log)); + g_return_if_fail (TPL_IS_ENTRY_TEXT (log)); - tpl_text = _tpl_log_entry_text_get_tpl_channel_text (log); + tpl_text = _tpl_entry_text_get_tpl_channel_text (log); if (error != NULL) { PATH_DEBUG (tpl_text, "An Unrecoverable error retrieving remote contact " "information occured: %s", error->message); PATH_DEBUG (tpl_text, "Unable to log the received message: %s", - tpl_log_entry_text_get_message (log)); + tpl_entry_text_get_message (log)); g_object_unref (log); return; } @@ -1249,7 +1249,7 @@ on_received_signal_with_contact_cb (TpConnection *connection, PATH_DEBUG (tpl_text, "%d invalid handle(s) passed to " "tp_connection_get_contacts_by_handle()", n_failed); PATH_DEBUG (tpl_text, "Not able to log the received message: %s", - tpl_log_entry_text_get_message (log)); + tpl_entry_text_get_message (log)); g_object_unref (log); return; } @@ -1262,9 +1262,9 @@ on_received_signal_with_contact_cb (TpConnection *connection, static void -keepon_on_receiving_signal (TplLogEntryText *text_log) +keepon_on_receiving_signal (TplEntryText *text_log) { - TplLogEntry *log = TPL_LOG_ENTRY (text_log); + TplEntry *log = TPL_ENTRY (text_log); TplChannelText *tpl_text; GError *e = NULL; TplLogManager *logmanager; @@ -1273,39 +1273,39 @@ keepon_on_receiving_signal (TplLogEntryText *text_log) TpContact *remote; TpContact *local; - g_return_if_fail (TPL_IS_LOG_ENTRY_TEXT (text_log)); + g_return_if_fail (TPL_IS_ENTRY_TEXT (text_log)); - tpl_text = _tpl_log_entry_text_get_tpl_channel_text (text_log); + tpl_text = _tpl_entry_text_get_tpl_channel_text (text_log); remote = _tpl_channel_text_get_remote_contact (tpl_text); local = _tpl_channel_text_get_my_contact (tpl_text); tpl_contact_sender = _tpl_contact_from_tp_contact (remote); _tpl_contact_set_contact_type (tpl_contact_sender, TPL_CONTACT_USER); - _tpl_log_entry_set_sender (log, tpl_contact_sender); + _tpl_entry_set_sender (log, tpl_contact_sender); tpl_contact_receiver = _tpl_contact_from_tp_contact (local); DEBUG ("recvd:\n\tlog_id=\"%s\"\n\tto=\"%s (%s)\"\n\tfrom=\"%s (%s)\"\n\tmsg=\"%s\"", - _tpl_log_entry_get_log_id (log), + _tpl_entry_get_log_id (log), tpl_contact_get_identifier (tpl_contact_receiver), tpl_contact_get_alias (tpl_contact_receiver), tpl_contact_get_identifier (tpl_contact_sender), tpl_contact_get_alias (tpl_contact_sender), - tpl_log_entry_text_get_message (text_log)); + tpl_entry_text_get_message (text_log)); if (!_tpl_channel_text_is_chatroom (tpl_text)) - _tpl_log_entry_set_chat_id (log, tpl_contact_get_identifier ( + _tpl_entry_set_chat_id (log, tpl_contact_get_identifier ( tpl_contact_sender)); else - _tpl_log_entry_set_chat_id (log, _tpl_channel_text_get_chatroom_id ( + _tpl_entry_set_chat_id (log, _tpl_channel_text_get_chatroom_id ( tpl_text)); - _tpl_log_entry_text_set_chatroom (text_log, + _tpl_entry_text_set_chatroom (text_log, _tpl_channel_text_is_chatroom (tpl_text)); logmanager = tpl_log_manager_dup_singleton (); - _tpl_log_manager_add_message (logmanager, TPL_LOG_ENTRY (log), &e); + _tpl_log_manager_add_message (logmanager, TPL_ENTRY (log), &e); if (e != NULL) { DEBUG ("%s", e->message); @@ -1335,8 +1335,8 @@ on_received_signal_cb (TpChannel *proxy, TpConnection *tp_conn; TpContact *me; TplContact *tpl_contact_receiver = NULL; - TplLogEntryText *text_log = NULL; - TplLogEntry *log; + TplEntryText *text_log = NULL; + TplEntry *log; TpAccount *account = _tpl_channel_get_account (TPL_CHANNEL (tpl_text)); TplLogStore *index = _tpl_log_store_sqlite_dup (); const gchar *account_path = tp_proxy_get_object_path (TP_PROXY (account)); @@ -1371,25 +1371,25 @@ on_received_signal_cb (TpChannel *proxy, return; } - /* Initialize TplLogEntryText (part 1) - chat_id still unknown */ - text_log = _tpl_log_entry_text_new (log_id, account_path, - TPL_LOG_ENTRY_DIRECTION_IN); - log = TPL_LOG_ENTRY (text_log); + /* Initialize TplEntryText (part 1) - chat_id still unknown */ + text_log = _tpl_entry_text_new (log_id, account_path, + TPL_ENTRY_DIRECTION_IN); + log = TPL_ENTRY (text_log); - _tpl_log_entry_set_channel_path (log, channel_path); - _tpl_log_entry_set_pending_msg_id (log, arg_ID); - _tpl_log_entry_text_set_tpl_channel_text (text_log, tpl_text); - _tpl_log_entry_text_set_message (text_log, arg_Text); - _tpl_log_entry_text_set_message_type (text_log, arg_Type); - _tpl_log_entry_set_signal_type (log, - TPL_LOG_ENTRY_TEXT_SIGNAL_RECEIVED); + _tpl_entry_set_channel_path (log, channel_path); + _tpl_entry_set_pending_msg_id (log, arg_ID); + _tpl_entry_text_set_tpl_channel_text (text_log, tpl_text); + _tpl_entry_text_set_message (text_log, arg_Text); + _tpl_entry_text_set_message_type (text_log, arg_Type); + _tpl_entry_set_signal_type (log, + TPL_ENTRY_TEXT_SIGNAL_RECEIVED); me = _tpl_channel_text_get_my_contact (tpl_text); tpl_contact_receiver = _tpl_contact_from_tp_contact (me); _tpl_contact_set_contact_type (tpl_contact_receiver, TPL_CONTACT_USER); - _tpl_log_entry_set_receiver (log, tpl_contact_receiver); + _tpl_entry_set_receiver (log, tpl_contact_receiver); - _tpl_log_entry_set_timestamp (log, (time_t) arg_Timestamp); + _tpl_entry_set_timestamp (log, (time_t) arg_Timestamp); tp_conn = tp_channel_borrow_connection (TP_CHANNEL (tpl_chan)); /* it's a chatroom and no contact has been pre-cached */ diff --git a/telepathy-logger/dbus-service.c b/telepathy-logger/dbus-service.c index 5a351b8f3..159fbdf64 100644 --- a/telepathy-logger/dbus-service.c +++ b/telepathy-logger/dbus-service.c @@ -405,12 +405,12 @@ _get_messages_return (GObject *manager, ptr != NULL && ctx->lines > 0; ptr = g_list_previous (ptr)) { - TplLogEntry *log = ptr->data; - const char *message = tpl_log_entry_text_get_message ( - TPL_LOG_ENTRY_TEXT (log)); + TplEntry *log = ptr->data; + const char *message = tpl_entry_text_get_message ( + TPL_ENTRY_TEXT (log)); const char *sender = tpl_contact_get_identifier ( - tpl_log_entry_get_sender (log)); - gint64 timestamp = tpl_log_entry_get_timestamp (log); + tpl_entry_get_sender (log)); + gint64 timestamp = tpl_entry_get_timestamp (log); DEBUG ("Message: %" G_GINT64_FORMAT " <%s> %s", timestamp, sender, message); diff --git a/telepathy-logger/entry-internal.h b/telepathy-logger/entry-internal.h index abf77bc6e..608b2ea8d 100644 --- a/telepathy-logger/entry-internal.h +++ b/telepathy-logger/entry-internal.h @@ -19,98 +19,98 @@ * Authors: Cosimo Alfarano */ -#ifndef __TPL_LOG_ENTRY_INTERNAL_H__ -#define __TPL_LOG_ENTRY_INTERNAL_H__ +#ifndef __TPL_ENTRY_INTERNAL_H__ +#define __TPL_ENTRY_INTERNAL_H__ #include G_BEGIN_DECLS -#define TPL_LOG_ENTRY_MSG_ID_IS_VALID(msg) (msg >= 0) +#define TPL_ENTRY_MSG_ID_IS_VALID(msg) (msg >= 0) -#define TPL_LOG_ENTRY_MSG_ID_UNKNOWN -2 -#define TPL_LOG_ENTRY_MSG_ID_ACKNOWLEDGED -1 +#define TPL_ENTRY_MSG_ID_UNKNOWN -2 +#define TPL_ENTRY_MSG_ID_ACKNOWLEDGED -1 typedef enum { - TPL_LOG_ENTRY_DIRECTION_NONE = 0, + TPL_ENTRY_DIRECTION_NONE = 0, - TPL_LOG_ENTRY_DIRECTION_IN, - TPL_LOG_ENTRY_DIRECTION_OUT -} TplLogEntryDirection; + TPL_ENTRY_DIRECTION_IN, + TPL_ENTRY_DIRECTION_OUT +} TplEntryDirection; typedef enum { - TPL_LOG_ENTRY_SIGNAL_NONE = 0, + TPL_ENTRY_SIGNAL_NONE = 0, - TPL_LOG_ENTRY_CHANNEL_TEXT_SIGNAL_SENT, - TPL_LOG_ENTRY_CHANNEL_TEXT_SIGNAL_RECEIVED, - TPL_LOG_ENTRY_CHANNEL_TEXT_SIGNAL_SEND_ERROR, - TPL_LOG_ENTRY_CHANELL_TEXT_SIGNAL_LOST_MESSAGE, - TPL_LOG_ENTRY_CHANNEL_TEXT_SIGNAL_CHAT_STATUS_CHANGED, + TPL_ENTRY_CHANNEL_TEXT_SIGNAL_SENT, + TPL_ENTRY_CHANNEL_TEXT_SIGNAL_RECEIVED, + TPL_ENTRY_CHANNEL_TEXT_SIGNAL_SEND_ERROR, + TPL_ENTRY_CHANELL_TEXT_SIGNAL_LOST_MESSAGE, + TPL_ENTRY_CHANNEL_TEXT_SIGNAL_CHAT_STATUS_CHANGED, - TPL_LOG_ENTRY_CHANNEL_SIGNAL_CHANNEL_CLOSED + TPL_ENTRY_CHANNEL_SIGNAL_CHANNEL_CLOSED -} TplLogEntrySignalType; +} TplEntrySignalType; typedef enum { - TPL_LOG_ENTRY_ERROR, - TPL_LOG_ENTRY_TEXT -} TplLogEntryType; + TPL_ENTRY_ERROR, + TPL_ENTRY_TEXT +} TplEntryType; -struct _TplLogEntry +struct _TplEntry { GObject parent; /* Private */ - TplLogEntryPriv *priv; + TplEntryPriv *priv; }; -struct _TplLogEntryClass { +struct _TplEntryClass { GObjectClass parent_class; /* to be implemented only by subclasses */ - gboolean (*equal) (TplLogEntry *entry1, TplLogEntry *entry2); + gboolean (*equal) (TplEntry *entry1, TplEntry *entry2); }; -void _tpl_log_entry_set_timestamp (TplLogEntry *self, +void _tpl_entry_set_timestamp (TplEntry *self, gint64 data); -void _tpl_log_entry_set_pending_msg_id (TplLogEntry *self, +void _tpl_entry_set_pending_msg_id (TplEntry *self, gint data); -void _tpl_log_entry_set_signal_type (TplLogEntry *self, - TplLogEntrySignalType data); +void _tpl_entry_set_signal_type (TplEntry *self, + TplEntrySignalType data); -void _tpl_log_entry_set_direction (TplLogEntry *self, - TplLogEntryDirection data); +void _tpl_entry_set_direction (TplEntry *self, + TplEntryDirection data); -void _tpl_log_entry_set_chat_id (TplLogEntry *self, +void _tpl_entry_set_chat_id (TplEntry *self, const gchar *data); -void _tpl_log_entry_set_channel_path (TplLogEntry *self, +void _tpl_entry_set_channel_path (TplEntry *self, const gchar *data); -void _tpl_log_entry_set_sender (TplLogEntry *self, +void _tpl_entry_set_sender (TplEntry *self, TplContact *data); -void _tpl_log_entry_set_receiver (TplLogEntry *self, +void _tpl_entry_set_receiver (TplEntry *self, TplContact *data); -gboolean _tpl_log_entry_is_pending (TplLogEntry *self); -TplLogEntrySignalType _tpl_log_entry_get_signal_type (TplLogEntry *self); -const gchar * _tpl_log_entry_get_chat_id (TplLogEntry * self); -const gchar * _tpl_log_entry_get_channel_path (TplLogEntry *self); +gboolean _tpl_entry_is_pending (TplEntry *self); +TplEntrySignalType _tpl_entry_get_signal_type (TplEntry *self); +const gchar * _tpl_entry_get_chat_id (TplEntry * self); +const gchar * _tpl_entry_get_channel_path (TplEntry *self); -TplLogEntryDirection _tpl_log_entry_get_direction (TplLogEntry *self); +TplEntryDirection _tpl_entry_get_direction (TplEntry *self); -gboolean _tpl_log_entry_equal (TplLogEntry *self, - TplLogEntry *data); +gboolean _tpl_entry_equal (TplEntry *self, + TplEntry *data); -const gchar * _tpl_log_entry_get_log_id (TplLogEntry *self); +const gchar * _tpl_entry_get_log_id (TplEntry *self); G_END_DECLS -#endif // __TPL_LOG_ENTRY_INTERNAL_H__ +#endif // __TPL_ENTRY_INTERNAL_H__ diff --git a/telepathy-logger/entry-text-internal.h b/telepathy-logger/entry-text-internal.h index 003a787f0..f12f60225 100644 --- a/telepathy-logger/entry-text-internal.h +++ b/telepathy-logger/entry-text-internal.h @@ -19,8 +19,8 @@ * Authors: Cosimo Alfarano */ -#ifndef __TPL_LOG_ENTRY_TEXT_INTERNAL_H__ -#define __TPL_LOG_ENTRY_TEXT_INTERNAL_H__ +#ifndef __TPL_ENTRY_TEXT_INTERNAL_H__ +#define __TPL_ENTRY_TEXT_INTERNAL_H__ #include #include @@ -30,60 +30,60 @@ G_BEGIN_DECLS typedef enum { - TPL_LOG_ENTRY_TEXT_SIGNAL_NONE = 0, - TPL_LOG_ENTRY_TEXT_SIGNAL_SENT, - TPL_LOG_ENTRY_TEXT_SIGNAL_RECEIVED, - TPL_LOG_ENTRY_TEXT_SIGNAL_SEND_ERROR, - TPL_LOG_ENTRY_TEXT_SIGNAL_LOST_MESSAGE, - TPL_LOG_ENTRY_TEXT_SIGNAL_CHAT_STATUS_CHANGED, - TPL_LOG_ENTRY_SIGNAL_CHANNEL_CLOSED -} TplLogEntryTextSignalType; - -struct _TplLogEntryText + TPL_ENTRY_TEXT_SIGNAL_NONE = 0, + TPL_ENTRY_TEXT_SIGNAL_SENT, + TPL_ENTRY_TEXT_SIGNAL_RECEIVED, + TPL_ENTRY_TEXT_SIGNAL_SEND_ERROR, + TPL_ENTRY_TEXT_SIGNAL_LOST_MESSAGE, + TPL_ENTRY_TEXT_SIGNAL_CHAT_STATUS_CHANGED, + TPL_ENTRY_SIGNAL_CHANNEL_CLOSED +} TplEntryTextSignalType; + +struct _TplEntryText { - TplLogEntry parent; + TplEntry parent; /* Private */ - TplLogEntryTextPriv *priv; + TplEntryTextPriv *priv; }; -struct _TplLogEntryTextClass +struct _TplEntryTextClass { - TplLogEntryClass parent_class; + TplEntryClass parent_class; }; -TplLogEntryText * _tpl_log_entry_text_new (const gchar* log_id, +TplEntryText * _tpl_entry_text_new (const gchar* log_id, const gchar *account_path, - TplLogEntryDirection direction); + TplEntryDirection direction); -TpChannelTextMessageType _tpl_log_entry_text_message_type_from_str ( +TpChannelTextMessageType _tpl_entry_text_message_type_from_str ( const gchar *type_str); -const gchar * _tpl_log_entry_text_message_type_to_str ( +const gchar * _tpl_entry_text_message_type_to_str ( TpChannelTextMessageType msg_type); -TplChannelText * _tpl_log_entry_text_get_tpl_channel_text ( - TplLogEntryText *self); +TplChannelText * _tpl_entry_text_get_tpl_channel_text ( + TplEntryText *self); -void _tpl_log_entry_text_set_tpl_channel_text (TplLogEntryText *self, +void _tpl_entry_text_set_tpl_channel_text (TplEntryText *self, TplChannelText *data); -void _tpl_log_entry_text_set_message (TplLogEntryText *self, +void _tpl_entry_text_set_message (TplEntryText *self, const gchar *data); -void _tpl_log_entry_text_set_message_type (TplLogEntryText *self, +void _tpl_entry_text_set_message_type (TplEntryText *self, TpChannelTextMessageType data); -void _tpl_log_entry_text_set_chatroom (TplLogEntryText *self, +void _tpl_entry_text_set_chatroom (TplEntryText *self, gboolean data); -TpChannelTextMessageType _tpl_log_entry_text_get_message_type ( - TplLogEntryText *self); +TpChannelTextMessageType _tpl_entry_text_get_message_type ( + TplEntryText *self); -gboolean _tpl_log_entry_text_is_chatroom (TplLogEntryText *self); +gboolean _tpl_entry_text_is_chatroom (TplEntryText *self); -gboolean _tpl_log_entry_text_equal (TplLogEntry *message1, - TplLogEntry *message2); +gboolean _tpl_entry_text_equal (TplEntry *message1, + TplEntry *message2); G_END_DECLS -#endif // __TPL_LOG_ENTRY_TEXT_INTERNAL_H__ +#endif // __TPL_ENTRY_TEXT_INTERNAL_H__ diff --git a/telepathy-logger/entry-text.c b/telepathy-logger/entry-text.c index 52d6affe3..35c913b05 100644 --- a/telepathy-logger/entry-text.c +++ b/telepathy-logger/entry-text.c @@ -33,9 +33,9 @@ #include #include -G_DEFINE_TYPE (TplLogEntryText, tpl_log_entry_text, TPL_TYPE_LOG_ENTRY) +G_DEFINE_TYPE (TplEntryText, tpl_entry_text, TPL_TYPE_ENTRY) -struct _TplLogEntryTextPriv +struct _TplEntryTextPriv { TplChannelText *tpl_text; TpChannelTextMessageType message_type; @@ -52,10 +52,10 @@ enum static void -tpl_log_entry_text_dispose (GObject * obj) +tpl_entry_text_dispose (GObject * obj) { - TplLogEntryText *self = TPL_LOG_ENTRY_TEXT (obj); - TplLogEntryTextPriv *priv = self->priv; + TplEntryText *self = TPL_ENTRY_TEXT (obj); + TplEntryTextPriv *priv = self->priv; if (priv->tpl_text != NULL) { @@ -63,30 +63,30 @@ tpl_log_entry_text_dispose (GObject * obj) priv->tpl_text = NULL; } - G_OBJECT_CLASS (tpl_log_entry_text_parent_class)->dispose (obj); + G_OBJECT_CLASS (tpl_entry_text_parent_class)->dispose (obj); } static void -tpl_log_entry_text_finalize (GObject * obj) +tpl_entry_text_finalize (GObject * obj) { - TplLogEntryText *self = TPL_LOG_ENTRY_TEXT (obj); - TplLogEntryTextPriv *priv = self->priv; + TplEntryText *self = TPL_ENTRY_TEXT (obj); + TplEntryTextPriv *priv = self->priv; g_free (priv->message); priv->message = NULL; - G_OBJECT_CLASS (tpl_log_entry_text_parent_class)->finalize (obj); + G_OBJECT_CLASS (tpl_entry_text_parent_class)->finalize (obj); } static void -tpl_log_entry_text_get_property (GObject *object, +tpl_entry_text_get_property (GObject *object, guint param_id, GValue *value, GParamSpec *pspec) { - TplLogEntryTextPriv *priv = TPL_LOG_ENTRY_TEXT (object)->priv; + TplEntryTextPriv *priv = TPL_ENTRY_TEXT (object)->priv; switch (param_id) { @@ -107,22 +107,22 @@ tpl_log_entry_text_get_property (GObject *object, static void -tpl_log_entry_text_set_property (GObject *object, +tpl_entry_text_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec) { - TplLogEntryText *self = TPL_LOG_ENTRY_TEXT (object); + TplEntryText *self = TPL_ENTRY_TEXT (object); switch (param_id) { case PROP_MESSAGE_TYPE: - _tpl_log_entry_text_set_message_type (self, g_value_get_uint (value)); + _tpl_entry_text_set_message_type (self, g_value_get_uint (value)); break; case PROP_MESSAGE: - _tpl_log_entry_text_set_message (self, g_value_get_string (value)); + _tpl_entry_text_set_message (self, g_value_get_string (value)); break; case PROP_TPL_CHANNEL_TEXT: - _tpl_log_entry_text_set_tpl_channel_text (self, + _tpl_entry_text_set_tpl_channel_text (self, g_value_get_object (value)); break; default: @@ -132,17 +132,17 @@ tpl_log_entry_text_set_property (GObject *object, } -static void tpl_log_entry_text_class_init (TplLogEntryTextClass *klass) +static void tpl_entry_text_class_init (TplEntryTextClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - TplLogEntryClass *log_entry_class = TPL_LOG_ENTRY_CLASS (klass); + TplEntryClass *entry_class = TPL_ENTRY_CLASS (klass); GParamSpec *param_spec; - object_class->finalize = tpl_log_entry_text_finalize; - object_class->dispose = tpl_log_entry_text_dispose; - object_class->get_property = tpl_log_entry_text_get_property; - object_class->set_property = tpl_log_entry_text_set_property; - log_entry_class->equal = _tpl_log_entry_text_equal; + object_class->finalize = tpl_entry_text_finalize; + object_class->dispose = tpl_entry_text_dispose; + object_class->get_property = tpl_entry_text_get_property; + object_class->set_property = tpl_entry_text_set_property; + entry_class->equal = _tpl_entry_text_equal; param_spec = g_param_spec_uint ("message-type", "MessageType", @@ -163,26 +163,26 @@ static void tpl_log_entry_text_class_init (TplLogEntryTextClass *klass) TPL_TYPE_CHANNEL_TEXT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_TPL_CHANNEL_TEXT, param_spec); - g_type_class_add_private (object_class, sizeof (TplLogEntryTextPriv)); + g_type_class_add_private (object_class, sizeof (TplEntryTextPriv)); } static void -tpl_log_entry_text_init (TplLogEntryText *self) +tpl_entry_text_init (TplEntryText *self) { - TplLogEntryTextPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - TPL_TYPE_LOG_ENTRY_TEXT, TplLogEntryTextPriv); + TplEntryTextPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + TPL_TYPE_ENTRY_TEXT, TplEntryTextPriv); self->priv = priv; } -TplLogEntryText * -_tpl_log_entry_text_new (const gchar *log_id, +TplEntryText * +_tpl_entry_text_new (const gchar *log_id, const gchar *account_path, - TplLogEntryDirection direction) + TplEntryDirection direction) { - return g_object_new (TPL_TYPE_LOG_ENTRY_TEXT, + return g_object_new (TPL_TYPE_ENTRY_TEXT, "log-id", log_id, "account-path", account_path, "direction", direction, @@ -199,7 +199,7 @@ static gchar *message_types[] = { /** - * _tpl_log_entry_text_message_type_from_str + * _tpl_entry_text_message_type_from_str * @type_str: string to transform into a #TpChannelTextMessageType * * Maps strings into enum #TpChannelTextMessageType values. @@ -208,7 +208,7 @@ static gchar *message_types[] = { * mapping is found, or defaults to %TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL if not. */ TpChannelTextMessageType -_tpl_log_entry_text_message_type_from_str (const gchar *type_str) +_tpl_entry_text_message_type_from_str (const gchar *type_str) { guint i; for (i = 0; i < G_N_ELEMENTS (message_types); ++i) @@ -221,7 +221,7 @@ _tpl_log_entry_text_message_type_from_str (const gchar *type_str) /** - * _tpl_log_entry_text_message_type_to_str + * _tpl_entry_text_message_type_to_str * @msg_type: message type to transform into a string * * Maps enum #TpChannelTextMessageType values into strings @@ -230,7 +230,7 @@ _tpl_log_entry_text_message_type_from_str (const gchar *type_str) * a legal value for %TpChannelTextMessageType. */ const gchar * -_tpl_log_entry_text_message_type_to_str (TpChannelTextMessageType msg_type) +_tpl_entry_text_message_type_to_str (TpChannelTextMessageType msg_type) { g_return_val_if_fail (G_N_ELEMENTS (message_types) >= msg_type, NULL); @@ -239,36 +239,36 @@ _tpl_log_entry_text_message_type_to_str (TpChannelTextMessageType msg_type) gboolean -_tpl_log_entry_text_is_chatroom (TplLogEntryText * self) +_tpl_entry_text_is_chatroom (TplEntryText * self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY_TEXT (self), FALSE); + g_return_val_if_fail (TPL_IS_ENTRY_TEXT (self), FALSE); return self->priv->chatroom; } TplChannelText * -_tpl_log_entry_text_get_tpl_channel_text (TplLogEntryText * self) +_tpl_entry_text_get_tpl_channel_text (TplEntryText * self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY_TEXT (self), NULL); + g_return_val_if_fail (TPL_IS_ENTRY_TEXT (self), NULL); return self->priv->tpl_text; } const gchar * -tpl_log_entry_text_get_message (TplLogEntryText * self) +tpl_entry_text_get_message (TplEntryText * self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY_TEXT (self), NULL); + g_return_val_if_fail (TPL_IS_ENTRY_TEXT (self), NULL); return self->priv->message; } TpChannelTextMessageType -_tpl_log_entry_text_get_message_type (TplLogEntryText * self) +_tpl_entry_text_get_message_type (TplEntryText * self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY_TEXT (self), + g_return_val_if_fail (TPL_IS_ENTRY_TEXT (self), TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL); return self->priv->message_type; @@ -276,12 +276,12 @@ _tpl_log_entry_text_get_message_type (TplLogEntryText * self) void -_tpl_log_entry_text_set_tpl_channel_text (TplLogEntryText * self, +_tpl_entry_text_set_tpl_channel_text (TplEntryText * self, TplChannelText *data) { - TplLogEntryTextPriv *priv; + TplEntryTextPriv *priv; - g_return_if_fail (TPL_IS_LOG_ENTRY_TEXT (self)); + g_return_if_fail (TPL_IS_ENTRY_TEXT (self)); g_return_if_fail (TPL_IS_CHANNEL_TEXT (data) || data == NULL); priv = self->priv; @@ -292,12 +292,12 @@ _tpl_log_entry_text_set_tpl_channel_text (TplLogEntryText * self, void -_tpl_log_entry_text_set_message (TplLogEntryText *self, +_tpl_entry_text_set_message (TplEntryText *self, const gchar *data) { - TplLogEntryTextPriv *priv; + TplEntryTextPriv *priv; - g_return_if_fail (TPL_IS_LOG_ENTRY_TEXT (self)); + g_return_if_fail (TPL_IS_ENTRY_TEXT (self)); g_return_if_fail (data != NULL); /* allow zero length */ priv = self->priv; @@ -308,30 +308,30 @@ _tpl_log_entry_text_set_message (TplLogEntryText *self, void -_tpl_log_entry_text_set_message_type (TplLogEntryText *self, +_tpl_entry_text_set_message_type (TplEntryText *self, TpChannelTextMessageType data) { - g_return_if_fail (TPL_IS_LOG_ENTRY_TEXT (self)); + g_return_if_fail (TPL_IS_ENTRY_TEXT (self)); self->priv->message_type = data; } void -_tpl_log_entry_text_set_chatroom (TplLogEntryText *self, +_tpl_entry_text_set_chatroom (TplEntryText *self, gboolean data) { - g_return_if_fail (TPL_IS_LOG_ENTRY_TEXT (self)); + g_return_if_fail (TPL_IS_ENTRY_TEXT (self)); self->priv->chatroom = data; } gboolean -_tpl_log_entry_text_equal (TplLogEntry *message1, - TplLogEntry *message2) +_tpl_entry_text_equal (TplEntry *message1, + TplEntry *message2) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY_TEXT (message1), FALSE); - g_return_val_if_fail (TPL_IS_LOG_ENTRY_TEXT (message2), FALSE); + g_return_val_if_fail (TPL_IS_ENTRY_TEXT (message1), FALSE); + g_return_val_if_fail (TPL_IS_ENTRY_TEXT (message2), FALSE); /* if (priv1->id == priv2->id && !tp_strdiff (priv1->body, priv2->body)) { @@ -339,6 +339,6 @@ _tpl_log_entry_text_equal (TplLogEntry *message1, if (!tp_strdiff (priv1->entry.text->message, priv2->entry.text->message)) { } */ - return !tp_strdiff (_tpl_log_entry_get_log_id (message1), - _tpl_log_entry_get_log_id (message2)); + return !tp_strdiff (_tpl_entry_get_log_id (message1), + _tpl_entry_get_log_id (message2)); } diff --git a/telepathy-logger/entry-text.h b/telepathy-logger/entry-text.h index c3ba4cd1b..4869bdea7 100644 --- a/telepathy-logger/entry-text.h +++ b/telepathy-logger/entry-text.h @@ -19,28 +19,28 @@ * Authors: Cosimo Alfarano */ -#ifndef __TPL_LOG_ENTRY_TEXT_H__ -#define __TPL_LOG_ENTRY_TEXT_H__ +#ifndef __TPL_ENTRY_TEXT_H__ +#define __TPL_ENTRY_TEXT_H__ #include #include G_BEGIN_DECLS -#define TPL_TYPE_LOG_ENTRY_TEXT (tpl_log_entry_text_get_type ()) -#define TPL_LOG_ENTRY_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPL_TYPE_LOG_ENTRY_TEXT, TplLogEntryText)) -#define TPL_LOG_ENTRY_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPL_TYPE_LOG_ENTRY_TEXT, TplLogEntryTextClass)) -#define TPL_IS_LOG_ENTRY_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPL_TYPE_LOG_ENTRY_TEXT)) -#define TPL_IS_LOG_ENTRY_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPL_TYPE_LOG_ENTRY_TEXT)) -#define TPL_LOG_ENTRY_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_LOG_ENTRY_TEXT, TplLogEntryTextClass)) +#define TPL_TYPE_ENTRY_TEXT (tpl_entry_text_get_type ()) +#define TPL_ENTRY_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPL_TYPE_ENTRY_TEXT, TplEntryText)) +#define TPL_ENTRY_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPL_TYPE_ENTRY_TEXT, TplEntryTextClass)) +#define TPL_IS_ENTRY_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPL_TYPE_ENTRY_TEXT)) +#define TPL_IS_ENTRY_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPL_TYPE_ENTRY_TEXT)) +#define TPL_ENTRY_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_ENTRY_TEXT, TplEntryTextClass)) -typedef struct _TplLogEntryText TplLogEntryText; -typedef struct _TplLogEntryTextClass TplLogEntryTextClass; -typedef struct _TplLogEntryTextPriv TplLogEntryTextPriv; +typedef struct _TplEntryText TplEntryText; +typedef struct _TplEntryTextClass TplEntryTextClass; +typedef struct _TplEntryTextPriv TplEntryTextPriv; -GType tpl_log_entry_text_get_type (void); +GType tpl_entry_text_get_type (void); -const gchar *tpl_log_entry_text_get_message (TplLogEntryText *self); +const gchar *tpl_entry_text_get_message (TplEntryText *self); G_END_DECLS -#endif // __TPL_LOG_ENTRY_TEXT_H__ +#endif // __TPL_ENTRY_TEXT_H__ diff --git a/telepathy-logger/entry.c b/telepathy-logger/entry.c index 46bb1f512..e4785ad76 100644 --- a/telepathy-logger/entry.c +++ b/telepathy-logger/entry.c @@ -27,68 +27,68 @@ #include -#define DEBUG_FLAG TPL_DEBUG_LOG_ENTRY +#define DEBUG_FLAG TPL_DEBUG_ENTRY #include #include /** * SECTION:entry - * @title: TplLogEntry + * @title: TplEntry * @short_description: Abstract representation of a log entry - * @see_also: #TplLogEntryText and other subclasses when they'll exist + * @see_also: #TplEntryText and other subclasses when they'll exist * * The TPLogger log entry represent a generic log entry, which will be - * specialied by subclasses of #TplLogEntry. + * specialied by subclasses of #TplEntry. */ /** - * TPL_LOG_ENTRY_MSG_ID_IS_VALID: + * TPL_ENTRY_MSG_ID_IS_VALID: * @msg: a message ID * * Return whether a message ID is valid. * * If %FALSE is returned, it means that either a invalid input has been - * passed, or the TplLogEntry is currently set to %TPL_LOG_ENTRY_MSG_ID_UNKNOWN - * or %TPL_LOG_ENTRY_MSG_ID_ACKNOWLEDGED. + * passed, or the TplEntry is currently set to %TPL_ENTRY_MSG_ID_UNKNOWN + * or %TPL_ENTRY_MSG_ID_ACKNOWLEDGED. * * Returns: %TRUE if the argument is a valid message ID or %FALSE otherwise. */ /** - * TPL_LOG_ENTRY_MSG_ID_UNKNOWN: + * TPL_ENTRY_MSG_ID_UNKNOWN: * * Special value used instead of a message ID to indicate a message with an - * unknown status (before _tpl_log_entry_set_pending_msg_id() was called, or + * unknown status (before _tpl_entry_set_pending_msg_id() was called, or * when it wasn't possible to obtain the message ID). */ /** - * TPL_LOG_ENTRY_MSG_ID_ACKNOWLEDGED: + * TPL_ENTRY_MSG_ID_ACKNOWLEDGED: * * Special value used instead of a message ID to indicate an acknowledged * message. */ -G_DEFINE_ABSTRACT_TYPE (TplLogEntry, tpl_log_entry, G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE (TplEntry, tpl_entry, G_TYPE_OBJECT) -static void tpl_log_entry_set_log_id (TplLogEntry *self, const gchar *data); -static void tpl_log_entry_set_account_path (TplLogEntry *self, +static void tpl_entry_set_log_id (TplEntry *self, const gchar *data); +static void tpl_entry_set_account_path (TplEntry *self, const gchar *data); -struct _TplLogEntryPriv +struct _TplEntryPriv { gchar *log_id; gint64 timestamp; - TplLogEntrySignalType signal_type; + TplEntrySignalType signal_type; gchar *chat_id; gchar *account_path; gchar *channel_path; - /* in specs it's guint, TplLogEntry needs a way to represent ACK'd messages: + /* in specs it's guint, TplEntry needs a way to represent ACK'd messages: * if pending_msg_id reachs G_MAXINT32, then the problem is elsewhere :-) */ gint pending_msg_id; /* incoming/outgoing */ - TplLogEntryDirection direction; + TplEntryDirection direction; /* message and receiver may be NULL depending on the signal. ie. status * changed signals set only the sender */ @@ -111,25 +111,25 @@ enum { static void -tpl_log_entry_finalize (GObject *obj) +tpl_entry_finalize (GObject *obj) { - TplLogEntry *self = TPL_LOG_ENTRY (obj); - TplLogEntryPriv *priv = self->priv; + TplEntry *self = TPL_ENTRY (obj); + TplEntryPriv *priv = self->priv; g_free (priv->chat_id); priv->chat_id = NULL; g_free (priv->account_path); priv->account_path = NULL; - G_OBJECT_CLASS (tpl_log_entry_parent_class)->finalize (obj); + G_OBJECT_CLASS (tpl_entry_parent_class)->finalize (obj); } static void -tpl_log_entry_dispose (GObject *obj) +tpl_entry_dispose (GObject *obj) { - TplLogEntry *self = TPL_LOG_ENTRY (obj); - TplLogEntryPriv *priv = self->priv; + TplEntry *self = TPL_ENTRY (obj); + TplEntryPriv *priv = self->priv; if (priv->sender != NULL) { @@ -142,18 +142,18 @@ tpl_log_entry_dispose (GObject *obj) priv->receiver = NULL; } - G_OBJECT_CLASS (tpl_log_entry_parent_class)->dispose (obj); + G_OBJECT_CLASS (tpl_entry_parent_class)->dispose (obj); } static void -tpl_log_entry_get_property (GObject *object, +tpl_entry_get_property (GObject *object, guint param_id, GValue *value, GParamSpec *pspec) { - TplLogEntry *self = TPL_LOG_ENTRY (object); - TplLogEntryPriv *priv = self->priv; + TplEntry *self = TPL_ENTRY (object); + TplEntryPriv *priv = self->priv; switch (param_id) { @@ -195,43 +195,43 @@ tpl_log_entry_get_property (GObject *object, static void -tpl_log_entry_set_property (GObject *object, +tpl_entry_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec) { - TplLogEntry *self = TPL_LOG_ENTRY (object); + TplEntry *self = TPL_ENTRY (object); switch (param_id) { case PROP_TIMESTAMP: - _tpl_log_entry_set_timestamp (self, g_value_get_uint (value)); + _tpl_entry_set_timestamp (self, g_value_get_uint (value)); break; case PROP_SIGNAL_TYPE: - _tpl_log_entry_set_signal_type (self, g_value_get_uint (value)); + _tpl_entry_set_signal_type (self, g_value_get_uint (value)); break; case PROP_PENDING_MSG_ID: - _tpl_log_entry_set_pending_msg_id (self, g_value_get_int (value)); + _tpl_entry_set_pending_msg_id (self, g_value_get_int (value)); break; case PROP_LOG_ID: - tpl_log_entry_set_log_id (self, g_value_get_string (value)); + tpl_entry_set_log_id (self, g_value_get_string (value)); break; case PROP_DIRECTION: - _tpl_log_entry_set_direction (self, g_value_get_uint (value)); + _tpl_entry_set_direction (self, g_value_get_uint (value)); break; case PROP_CHAT_ID: - _tpl_log_entry_set_chat_id (self, g_value_get_string (value)); + _tpl_entry_set_chat_id (self, g_value_get_string (value)); break; case PROP_ACCOUNT_PATH: - tpl_log_entry_set_account_path (self, g_value_get_string (value)); + tpl_entry_set_account_path (self, g_value_get_string (value)); break; case PROP_CHANNEL_PATH: - _tpl_log_entry_set_channel_path (self, g_value_get_string (value)); + _tpl_entry_set_channel_path (self, g_value_get_string (value)); break; case PROP_SENDER: - _tpl_log_entry_set_sender (self, g_value_get_object (value)); + _tpl_entry_set_sender (self, g_value_get_object (value)); break; case PROP_RECEIVER: - _tpl_log_entry_set_receiver (self, g_value_get_object (value)); + _tpl_entry_set_receiver (self, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); @@ -241,16 +241,16 @@ tpl_log_entry_set_property (GObject *object, static void -tpl_log_entry_class_init (TplLogEntryClass *klass) +tpl_entry_class_init (TplEntryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GParamSpec *param_spec; /* to be used by subclasses */ - object_class->finalize = tpl_log_entry_finalize; - object_class->dispose = tpl_log_entry_dispose; - object_class->get_property = tpl_log_entry_get_property; - object_class->set_property = tpl_log_entry_set_property; + object_class->finalize = tpl_entry_finalize; + object_class->dispose = tpl_entry_dispose; + object_class->get_property = tpl_entry_get_property; + object_class->set_property = tpl_entry_set_property; klass->equal = NULL; @@ -263,53 +263,53 @@ tpl_log_entry_class_init (TplLogEntryClass *klass) param_spec = g_param_spec_uint ("signal-type", "SignalType", "The signal type which caused the log entry", - 0, G_MAXUINT32, TPL_LOG_ENTRY_SIGNAL_NONE, G_PARAM_READWRITE | + 0, G_MAXUINT32, TPL_ENTRY_SIGNAL_NONE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_SIGNAL_TYPE, param_spec); /** - * TplLogEntry::pending-msg-id: + * TplEntry::pending-msg-id: * * The pending message id for the current log entry. - * The default value, is #TPL_LOG_ENTRY_MSG_ID_UNKNOWN, + * The default value, is #TPL_ENTRY_MSG_ID_UNKNOWN, * meaning that it's not possible to know if the message is pending or has * been acknowledged. * - * An object instantiating a TplLogEntry subclass should explicitly set it - * to a valid msg-id number (id>=0) or to #TPL_LOG_ENTRY_MSG_ID_ACKNOWLEDGED + * An object instantiating a TplEntry subclass should explicitly set it + * to a valid msg-id number (id>=0) or to #TPL_ENTRY_MSG_ID_ACKNOWLEDGED * when acknowledged or if the entry is a result of * 'sent' signal. * In fact a sent entry is considered as 'automatically' ACK by TPL. * * The pending message id value is only meaningful when associated to the - * #TplLogEntry::channel-path property. + * #TplEntry::channel-path property. * The couple (channel-path, pending-msg-id) cannot be considered unique, * though, since a message-id might be reused over time. * - * Use #TplLogEntry::log-id for a unique identifier within TPL. + * Use #TplEntry::log-id for a unique identifier within TPL. */ param_spec = g_param_spec_int ("pending-msg-id", "PendingMessageId", "Pending Message ID, if set, the log entry is set as pending for ACK." " Default to -1 meaning not pending.", - -1, G_MAXUINT32, TPL_LOG_ENTRY_MSG_ID_ACKNOWLEDGED, + -1, G_MAXUINT32, TPL_ENTRY_MSG_ID_ACKNOWLEDGED, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_PENDING_MSG_ID, param_spec); /** - * TplLogEntry::log-id: + * TplEntry::log-id: * * A token which can be trusted as unique over time within TPL. * - * Always use this token if you need to identify a TplLogEntry uniquely. + * Always use this token if you need to identify a TplEntry uniquely. * * @see_also: #Util:create_message_token for more information about how it's * built. */ param_spec = g_param_spec_string ("log-id", "LogId", - "Log identification token, it's unique among existing LogEntry, if two " + "Log identification token, it's unique among existing Entry, if two " "messages have the same token, they are the same entry (maybe logged " "by two different TplLogStore)", NULL, @@ -319,7 +319,7 @@ tpl_log_entry_class_init (TplLogEntryClass *klass) param_spec = g_param_spec_uint ("direction", "Direction", "The direction of the log entry (in/out)", - 0, G_MAXUINT32, TPL_LOG_ENTRY_DIRECTION_NONE, G_PARAM_READWRITE | + 0, G_MAXUINT32, TPL_ENTRY_DIRECTION_NONE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_DIRECTION, param_spec); @@ -359,123 +359,123 @@ tpl_log_entry_class_init (TplLogEntryClass *klass) TPL_TYPE_CONTACT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_RECEIVER, param_spec); - g_type_class_add_private (object_class, sizeof (TplLogEntryPriv)); + g_type_class_add_private (object_class, sizeof (TplEntryPriv)); } static void -tpl_log_entry_init (TplLogEntry *self) +tpl_entry_init (TplEntry *self) { - TplLogEntryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - TPL_TYPE_LOG_ENTRY, TplLogEntryPriv); + TplEntryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + TPL_TYPE_ENTRY, TplEntryPriv); self->priv = priv; } gint64 -tpl_log_entry_get_timestamp (TplLogEntry *self) +tpl_entry_get_timestamp (TplEntry *self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), -1); + g_return_val_if_fail (TPL_IS_ENTRY (self), -1); return self->priv->timestamp; } gint -tpl_log_entry_get_pending_msg_id (TplLogEntry *self) +tpl_entry_get_pending_msg_id (TplEntry *self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), -1); + g_return_val_if_fail (TPL_IS_ENTRY (self), -1); return self->priv->pending_msg_id; } gboolean -_tpl_log_entry_is_pending (TplLogEntry *self) +_tpl_entry_is_pending (TplEntry *self) { - return TPL_LOG_ENTRY_MSG_ID_IS_VALID ( - tpl_log_entry_get_pending_msg_id (self)); + return TPL_ENTRY_MSG_ID_IS_VALID ( + tpl_entry_get_pending_msg_id (self)); } -TplLogEntrySignalType -_tpl_log_entry_get_signal_type (TplLogEntry *self) +TplEntrySignalType +_tpl_entry_get_signal_type (TplEntry *self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), TPL_LOG_ENTRY_SIGNAL_NONE); + g_return_val_if_fail (TPL_IS_ENTRY (self), TPL_ENTRY_SIGNAL_NONE); return self->priv->signal_type; } const gchar * -_tpl_log_entry_get_log_id (TplLogEntry *self) +_tpl_entry_get_log_id (TplEntry *self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), 0); + g_return_val_if_fail (TPL_IS_ENTRY (self), 0); return self->priv->log_id; } -TplLogEntryDirection -_tpl_log_entry_get_direction (TplLogEntry *self) +TplEntryDirection +_tpl_entry_get_direction (TplEntry *self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), - TPL_LOG_ENTRY_DIRECTION_NONE); + g_return_val_if_fail (TPL_IS_ENTRY (self), + TPL_ENTRY_DIRECTION_NONE); return self->priv->direction; } TplContact * -tpl_log_entry_get_sender (TplLogEntry *self) +tpl_entry_get_sender (TplEntry *self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), NULL); + g_return_val_if_fail (TPL_IS_ENTRY (self), NULL); return self->priv->sender; } TplContact * -tpl_log_entry_get_receiver (TplLogEntry *self) +tpl_entry_get_receiver (TplEntry *self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), NULL); + g_return_val_if_fail (TPL_IS_ENTRY (self), NULL); return self->priv->receiver; } const gchar * -_tpl_log_entry_get_chat_id (TplLogEntry *self) +_tpl_entry_get_chat_id (TplEntry *self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), NULL); + g_return_val_if_fail (TPL_IS_ENTRY (self), NULL); return self->priv->chat_id; } const gchar * -tpl_log_entry_get_account_path (TplLogEntry *self) +tpl_entry_get_account_path (TplEntry *self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), NULL); + g_return_val_if_fail (TPL_IS_ENTRY (self), NULL); return self->priv->account_path; } const gchar * -_tpl_log_entry_get_channel_path (TplLogEntry *self) +_tpl_entry_get_channel_path (TplEntry *self) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), NULL); + g_return_val_if_fail (TPL_IS_ENTRY (self), NULL); return self->priv->channel_path; } void -_tpl_log_entry_set_timestamp (TplLogEntry *self, +_tpl_entry_set_timestamp (TplEntry *self, gint64 data) { - g_return_if_fail (TPL_IS_LOG_ENTRY (self)); + g_return_if_fail (TPL_IS_ENTRY (self)); self->priv->timestamp = data; g_object_notify (G_OBJECT (self), "timestamp"); @@ -483,29 +483,29 @@ _tpl_log_entry_set_timestamp (TplLogEntry *self, void -_tpl_log_entry_set_signal_type (TplLogEntry *self, - TplLogEntrySignalType data) +_tpl_entry_set_signal_type (TplEntry *self, + TplEntrySignalType data) { - g_return_if_fail (TPL_IS_LOG_ENTRY (self)); + g_return_if_fail (TPL_IS_ENTRY (self)); self->priv->signal_type = data; g_object_notify (G_OBJECT (self), "signal-type"); } /** - * _tpl_log_entry_set_pending_msg_id: - * @self: TplLogentry instance + * _tpl_entry_set_pending_msg_id: + * @self: TplEntry instance * @data: the pending message ID * * Sets @self to be associated to pending message id @data. * - * @see_also: #TplLogEntry::pending-msg-id for special values. + * @see_also: #TplEntry::pending-msg-id for special values. */ void -_tpl_log_entry_set_pending_msg_id (TplLogEntry *self, +_tpl_entry_set_pending_msg_id (TplEntry *self, gint data) { - g_return_if_fail (TPL_IS_LOG_ENTRY (self)); + g_return_if_fail (TPL_IS_ENTRY (self)); self->priv->pending_msg_id = data; g_object_notify (G_OBJECT (self), "pending-msg-id"); @@ -514,10 +514,10 @@ _tpl_log_entry_set_pending_msg_id (TplLogEntry *self, /* set just on construction time */ static void -tpl_log_entry_set_log_id (TplLogEntry *self, +tpl_entry_set_log_id (TplEntry *self, const gchar* data) { - g_return_if_fail (TPL_IS_LOG_ENTRY (self)); + g_return_if_fail (TPL_IS_ENTRY (self)); g_return_if_fail (!TPL_STR_EMPTY (data)); g_return_if_fail (self->priv->log_id == NULL); @@ -527,10 +527,10 @@ tpl_log_entry_set_log_id (TplLogEntry *self, void -_tpl_log_entry_set_direction (TplLogEntry *self, - TplLogEntryDirection data) +_tpl_entry_set_direction (TplEntry *self, + TplEntryDirection data) { - g_return_if_fail (TPL_IS_LOG_ENTRY (self)); + g_return_if_fail (TPL_IS_ENTRY (self)); self->priv->direction = data; g_object_notify (G_OBJECT (self), "direction"); @@ -538,12 +538,12 @@ _tpl_log_entry_set_direction (TplLogEntry *self, void -_tpl_log_entry_set_sender (TplLogEntry *self, +_tpl_entry_set_sender (TplEntry *self, TplContact *data) { - TplLogEntryPriv *priv; + TplEntryPriv *priv; - g_return_if_fail (TPL_IS_LOG_ENTRY (self)); + g_return_if_fail (TPL_IS_ENTRY (self)); g_return_if_fail (TPL_IS_CONTACT (data) || data == NULL); priv = self->priv; @@ -556,12 +556,12 @@ _tpl_log_entry_set_sender (TplLogEntry *self, void -_tpl_log_entry_set_receiver (TplLogEntry *self, +_tpl_entry_set_receiver (TplEntry *self, TplContact *data) { - TplLogEntryPriv *priv; + TplEntryPriv *priv; - g_return_if_fail (TPL_IS_LOG_ENTRY (self)); + g_return_if_fail (TPL_IS_ENTRY (self)); g_return_if_fail (TPL_IS_CONTACT (data) || data == NULL); priv = self->priv; @@ -576,10 +576,10 @@ _tpl_log_entry_set_receiver (TplLogEntry *self, void -_tpl_log_entry_set_chat_id (TplLogEntry *self, +_tpl_entry_set_chat_id (TplEntry *self, const gchar *data) { - g_return_if_fail (TPL_IS_LOG_ENTRY (self)); + g_return_if_fail (TPL_IS_ENTRY (self)); g_return_if_fail (!TPL_STR_EMPTY (data)); g_return_if_fail (self->priv->chat_id == NULL); @@ -589,10 +589,10 @@ _tpl_log_entry_set_chat_id (TplLogEntry *self, static void -tpl_log_entry_set_account_path (TplLogEntry *self, +tpl_entry_set_account_path (TplEntry *self, const gchar *data) { - g_return_if_fail (TPL_IS_LOG_ENTRY (self)); + g_return_if_fail (TPL_IS_ENTRY (self)); g_return_if_fail (!TPL_STR_EMPTY (data)); g_return_if_fail (self->priv->account_path == NULL); @@ -602,10 +602,10 @@ tpl_log_entry_set_account_path (TplLogEntry *self, void -_tpl_log_entry_set_channel_path (TplLogEntry *self, +_tpl_entry_set_channel_path (TplEntry *self, const gchar *data) { - g_return_if_fail (TPL_IS_LOG_ENTRY (self)); + g_return_if_fail (TPL_IS_ENTRY (self)); g_return_if_fail (!TPL_STR_EMPTY (data)); g_return_if_fail (self->priv->channel_path == NULL); @@ -614,21 +614,21 @@ _tpl_log_entry_set_channel_path (TplLogEntry *self, } /** - * _tpl_log_entry_equal: - * @self: TplLogEntry subclass instance - * @data: an instance of the same TplLogEntry subclass of @self + * _tpl_entry_equal: + * @self: TplEntry subclass instance + * @data: an instance of the same TplEntry subclass of @self * - * Checks if two instances of TplLogEntry represent the same data + * Checks if two instances of TplEntry represent the same data * * Returns: %TRUE if @data is the same type of @self and they hold the same * data, %FALSE otherwise */ gboolean -_tpl_log_entry_equal (TplLogEntry *self, - TplLogEntry *data) +_tpl_entry_equal (TplEntry *self, + TplEntry *data) { - g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), FALSE); - g_return_val_if_fail (TPL_IS_LOG_ENTRY (data), FALSE); + g_return_val_if_fail (TPL_IS_ENTRY (self), FALSE); + g_return_val_if_fail (TPL_IS_ENTRY (data), FALSE); - return TPL_LOG_ENTRY_GET_CLASS (self)->equal (self, data); + return TPL_ENTRY_GET_CLASS (self)->equal (self, data); } diff --git a/telepathy-logger/entry.h b/telepathy-logger/entry.h index 5123e86df..33730b865 100644 --- a/telepathy-logger/entry.h +++ b/telepathy-logger/entry.h @@ -19,35 +19,35 @@ * Authors: Cosimo Alfarano */ -#ifndef __TPL_LOG_ENTRY_H__ -#define __TPL_LOG_ENTRY_H__ +#ifndef __TPL_ENTRY_H__ +#define __TPL_ENTRY_H__ #include #include G_BEGIN_DECLS -#define TPL_TYPE_LOG_ENTRY (tpl_log_entry_get_type ()) -#define TPL_LOG_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPL_TYPE_LOG_ENTRY, TplLogEntry)) -#define TPL_LOG_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPL_TYPE_LOG_ENTRY, TplLogEntryClass)) -#define TPL_IS_LOG_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPL_TYPE_LOG_ENTRY)) -#define TPL_IS_LOG_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPL_TYPE_LOG_ENTRY)) -#define TPL_LOG_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_LOG_ENTRY, TplLogEntryClass)) +#define TPL_TYPE_ENTRY (tpl_entry_get_type ()) +#define TPL_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPL_TYPE_ENTRY, TplEntry)) +#define TPL_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPL_TYPE_ENTRY, TplEntryClass)) +#define TPL_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPL_TYPE_ENTRY)) +#define TPL_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPL_TYPE_ENTRY)) +#define TPL_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_ENTRY, TplEntryClass)) -typedef struct _TplLogEntry TplLogEntry; -typedef struct _TplLogEntryClass TplLogEntryClass; -typedef struct _TplLogEntryPriv TplLogEntryPriv; +typedef struct _TplEntry TplEntry; +typedef struct _TplEntryClass TplEntryClass; +typedef struct _TplEntryPriv TplEntryPriv; -GType tpl_log_entry_get_type (void); +GType tpl_entry_get_type (void); -gint64 tpl_log_entry_get_timestamp (TplLogEntry *self); +gint64 tpl_entry_get_timestamp (TplEntry *self); -const gchar *tpl_log_entry_get_account_path (TplLogEntry *self); +const gchar *tpl_entry_get_account_path (TplEntry *self); -TplContact * tpl_log_entry_get_sender (TplLogEntry *self); -TplContact * tpl_log_entry_get_receiver (TplLogEntry *self); +TplContact * tpl_entry_get_sender (TplEntry *self); +TplContact * tpl_entry_get_receiver (TplEntry *self); -gint tpl_log_entry_get_pending_msg_id (TplLogEntry *self); +gint tpl_entry_get_pending_msg_id (TplEntry *self); G_END_DECLS -#endif // __TPL_LOG_ENTRY_H__ +#endif // __TPL_ENTRY_H__ diff --git a/telepathy-logger/log-manager-internal.h b/telepathy-logger/log-manager-internal.h index 431bc3771..4c0cc5563 100644 --- a/telepathy-logger/log-manager-internal.h +++ b/telepathy-logger/log-manager-internal.h @@ -29,14 +29,14 @@ #include gboolean _tpl_log_manager_add_message (TplLogManager *manager, - TplLogEntry *message, GError **error); + TplEntry *message, GError **error); gboolean _tpl_log_manager_add_message_finish (TplLogManager *self, GAsyncResult *result, GError **error); void _tpl_log_manager_add_message_async (TplLogManager *manager, - TplLogEntry *message, GAsyncReadyCallback callback, gpointer user_data); + TplEntry *message, GAsyncReadyCallback callback, gpointer user_data); gboolean _tpl_log_manager_register_log_store (TplLogManager *self, TplLogStore *logstore); diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c index 605ea8e75..f3ca60598 100644 --- a/telepathy-logger/log-manager.c +++ b/telepathy-logger/log-manager.c @@ -67,7 +67,7 @@ typedef struct TplLogMessageFilter filter; gchar *search_text; gpointer user_data; - TplLogEntry *logentry; + TplEntry *logentry; } TplLogManagerChatInfo; @@ -206,7 +206,7 @@ tpl_log_manager_dup_singleton (void) /** * _tpl_log_manager_add_message * @manager: the log manager - * @message: a TplLogEntry subclass's instance + * @message: a TplEntry 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 @@ -221,7 +221,7 @@ tpl_log_manager_dup_singleton (void) */ gboolean _tpl_log_manager_add_message (TplLogManager *manager, - TplLogEntry *message, + TplEntry *message, GError **error) { TplLogManagerPriv *priv; @@ -230,7 +230,7 @@ _tpl_log_manager_add_message (TplLogManager *manager, g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (TPL_IS_LOG_MANAGER (manager), FALSE); - g_return_val_if_fail (TPL_IS_LOG_ENTRY (message), FALSE); + g_return_val_if_fail (TPL_IS_ENTRY (message), FALSE); priv = manager->priv; @@ -255,7 +255,7 @@ _tpl_log_manager_add_message (TplLogManager *manager, if (!retval) { CRITICAL ("Failed to write to all " - "writable LogStores log-id %s.", _tpl_log_entry_get_log_id (message)); + "writable LogStores log-id %s.", _tpl_entry_get_log_id (message)); g_set_error_literal (error, TPL_LOG_MANAGER_ERROR, TPL_LOG_MANAGER_ERROR_ADD_MESSAGE, "Not recoverable error occurred during log manager's " @@ -453,15 +453,15 @@ static gint log_manager_message_date_cmp (gconstpointer a, gconstpointer b) { - TplLogEntry *one = (TplLogEntry *) a; - TplLogEntry *two = (TplLogEntry *) b; + TplEntry *one = (TplEntry *) a; + TplEntry *two = (TplEntry *) b; gint64 one_time, two_time; - g_assert (TPL_IS_LOG_ENTRY (one)); - g_assert (TPL_IS_LOG_ENTRY (two)); + g_assert (TPL_IS_ENTRY (one)); + g_assert (TPL_IS_ENTRY (two)); - one_time = tpl_log_entry_get_timestamp (one); - two_time = tpl_log_entry_get_timestamp (two); + one_time = tpl_entry_get_timestamp (one); + two_time = tpl_entry_get_timestamp (two); /* return -1, o or 1 depending on message1 is newer, the same or older than * message2 */ @@ -811,7 +811,7 @@ _add_message_async_thread (GSimpleAsyncResult *simple, void _tpl_log_manager_add_message_async (TplLogManager *manager, - TplLogEntry *message, + TplEntry *message, GAsyncReadyCallback callback, gpointer user_data) { @@ -823,9 +823,9 @@ _tpl_log_manager_add_message_async (TplLogManager *manager, TPL_LOG_MANAGER, FAILED, "manager argument passed is not a TplManager instance", callback, user_data); - tpl_call_with_err_if_fail (TPL_IS_LOG_ENTRY (message), manager, + tpl_call_with_err_if_fail (TPL_IS_ENTRY (message), manager, TPL_LOG_MANAGER, FAILED, - "message argument passed is not a TplLogEntry instance", + "message argument passed is not a TplEntry instance", callback, user_data); chat_info->logentry = g_object_ref (message); @@ -1007,7 +1007,7 @@ tpl_log_manager_get_messages_for_date_finish (TplLogManager *self, static void _get_messages_for_date_async_result_free (gpointer data) { - GList *lst = data; /* list of TPL_LOG_ENTRY */ + GList *lst = data; /* list of TPL_ENTRY */ g_return_if_fail (data != NULL); g_list_foreach (lst, (GFunc) g_object_unref, NULL); @@ -1047,7 +1047,7 @@ _get_messages_for_date_async_thread (GSimpleAsyncResult *simple, * @callback: a callback to call when the request is satisfied * @user_data: data to pass to @callback * - * Retrieve a list of #TplLogEntry exchanged at @date with @chat_id. + * Retrieve a list of #TplEntry exchanged at @date with @chat_id. */ void tpl_log_manager_get_messages_for_date_async (TplLogManager *manager, @@ -1104,7 +1104,7 @@ tpl_log_manager_get_messages_for_date_async (TplLogManager *manager, * tpl_log_manager_get_filtered_messages_finish: * @manager: a #TplLogManager * @result: a #GAsyncResult - * @messages: a pointer to a #GList used to return the list #TplLogEntry + * @messages: a pointer to a #GList used to return the list #TplEntry * @error: a #GError to fill * * Returns: #TRUE if the operation was successful, otherwise #FALSE @@ -1137,7 +1137,7 @@ tpl_log_manager_get_filtered_messages_finish (TplLogManager *self, static void _get_filtered_messages_async_result_free (gpointer data) { - GList *lst = data; /* list of TPL_LOG_ENTRY */ + GList *lst = data; /* list of TPL_ENTRY */ g_return_if_fail (data != NULL); g_list_foreach (lst, (GFunc) g_object_unref, NULL); diff --git a/telepathy-logger/log-manager.h b/telepathy-logger/log-manager.h index c91dcfaf8..e3a7aed34 100644 --- a/telepathy-logger/log-manager.h +++ b/telepathy-logger/log-manager.h @@ -70,7 +70,7 @@ typedef struct GDate *date; } TplLogSearchHit; -typedef gboolean (*TplLogMessageFilter) (TplLogEntry *message, +typedef gboolean (*TplLogMessageFilter) (TplEntry *message, gpointer user_data); GType tpl_log_manager_get_type (void); diff --git a/telepathy-logger/log-store-internal.h b/telepathy-logger/log-store-internal.h index 4242dbe5c..d403e75e9 100644 --- a/telepathy-logger/log-store-internal.h +++ b/telepathy-logger/log-store-internal.h @@ -65,7 +65,7 @@ typedef struct const gchar * (*get_name) (TplLogStore *self); gboolean (*exists) (TplLogStore *self, TpAccount *account, const gchar *chat_id, gboolean chatroom); - gboolean (*add_message) (TplLogStore *self, TplLogEntry *message, + gboolean (*add_message) (TplLogStore *self, TplEntry *message, GError **error); GList * (*get_dates) (TplLogStore *self, TpAccount *account, const gchar *chat_id, gboolean chatroom); @@ -87,7 +87,7 @@ GType _tpl_log_store_get_type (void); const gchar * _tpl_log_store_get_name (TplLogStore *self); gboolean _tpl_log_store_exists (TplLogStore *self, TpAccount *account, const gchar *chat_id, gboolean chatroom); -gboolean _tpl_log_store_add_message (TplLogStore *self, TplLogEntry *message, +gboolean _tpl_log_store_add_message (TplLogStore *self, TplEntry *message, GError **error); GList * _tpl_log_store_get_dates (TplLogStore *self, TpAccount *account, const gchar *chat_id, gboolean chatroom); diff --git a/telepathy-logger/log-store-sqlite.c b/telepathy-logger/log-store-sqlite.c index 894c7962e..0525801c6 100644 --- a/telepathy-logger/log-store-sqlite.c +++ b/telepathy-logger/log-store-sqlite.c @@ -45,7 +45,7 @@ static void log_store_iface_init (TplLogStoreInterface *iface); static gboolean _insert_to_cache_table (TplLogStore *self, - TplLogEntry *message, GError **error); + TplEntry *message, GError **error); static void tpl_log_store_sqlite_purge (TplLogStoreSqlite *self, time_t delta, GError **error); static gboolean purge_entry_timeout (gpointer logstore); @@ -266,9 +266,9 @@ get_account_name (TpAccount *account) } static const char * -get_account_name_from_entry (TplLogEntry *entry) +get_account_name_from_entry (TplEntry *entry) { - return tpl_log_entry_get_account_path (entry) + + return tpl_entry_get_account_path (entry) + strlen (TP_ACCOUNT_OBJECT_PATH_BASE); } @@ -280,28 +280,28 @@ get_channel_name (TpChannel *chan) } static const char * -get_channel_name_from_entry (TplLogEntry *entry) +get_channel_name_from_entry (TplEntry *entry) { - return _tpl_log_entry_get_channel_path (entry) + + return _tpl_entry_get_channel_path (entry) + strlen (TP_CONN_OBJECT_PATH_BASE); } static char * -get_date (TplLogEntry *entry) +get_date (TplEntry *entry) { time_t t; - t = tpl_log_entry_get_timestamp (entry); + t = tpl_entry_get_timestamp (entry); return _tpl_time_to_string_utc (t, "%Y-%m-%d"); } static char * -get_datetime (TplLogEntry *entry) +get_datetime (TplEntry *entry) { time_t t; - t = tpl_log_entry_get_timestamp (entry); + t = tpl_entry_get_timestamp (entry); return _tpl_time_to_string_utc (t, TPL_LOG_STORE_SQLITE_TIMESTAMP_FORMAT); } @@ -422,7 +422,7 @@ out: static gboolean tpl_log_store_sqlite_add_message_counter (TplLogStore *self, - TplLogEntry *message, + TplEntry *message, GError **error) { TplLogStoreSqlitePrivate *priv = GET_PRIV (self); @@ -437,11 +437,11 @@ tpl_log_store_sqlite_add_message_counter (TplLogStore *self, g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - if (_tpl_log_entry_get_signal_type (message) != - TPL_LOG_ENTRY_TEXT_SIGNAL_RECEIVED) + if (_tpl_entry_get_signal_type (message) != + TPL_ENTRY_TEXT_SIGNAL_RECEIVED) { DEBUG ("ignoring msg %s, not interesting for message-counter", - _tpl_log_entry_get_log_id (message)); + _tpl_entry_get_log_id (message)); retval = TRUE; goto out; } @@ -449,8 +449,8 @@ tpl_log_store_sqlite_add_message_counter (TplLogStore *self, DEBUG ("message received"); account = get_account_name_from_entry (message); - identifier = _tpl_log_entry_get_chat_id (message); - chatroom = _tpl_log_entry_text_is_chatroom (TPL_LOG_ENTRY_TEXT (message)); + identifier = _tpl_entry_get_chat_id (message); + chatroom = _tpl_entry_text_is_chatroom (TPL_ENTRY_TEXT (message)); date = get_date (message); DEBUG ("account = %s", account); @@ -571,7 +571,7 @@ out: static gboolean tpl_log_store_sqlite_add_message_cache (TplLogStore *self, - TplLogEntry *message, + TplEntry *message, GError **error) { const char *log_id; @@ -579,7 +579,7 @@ tpl_log_store_sqlite_add_message_cache (TplLogStore *self, g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - log_id = _tpl_log_entry_get_log_id (message); + log_id = _tpl_entry_get_log_id (message); DEBUG ("received %s, considering if can be cached", log_id); if (_tpl_log_store_sqlite_log_id_is_present (self, log_id)) { @@ -605,24 +605,24 @@ out: /** * tpl_log_store_sqlite_add_message: * @self: TplLogstoreSqlite instance - * @message: a TplLogEntry instance + * @message: a TplEntry instance * @error: memory pointer use in case of error * * @message will be sent to the MessageCounter and MessageSqlite tables. * - * MessageSqlite will accept any instance of TplLogEntry for @message and will + * MessageSqlite will accept any instance of TplEntry for @message and will * return %FALSE with @error set when a fatal error occurs or when @message * has already been logged. * For the last case a TPL_LOG_STORE_ERROR_PRESENT will be set as error * code in @error, and is considered fatal, since it should never happen. * - * A module implementing a TplChannel should always check for TplLogEntry + * A module implementing a TplChannel should always check for TplEntry * log-id presence in the cache log-store if there is a chance to receive the * same log-id twice. * * MessageCounter only handles Text messages, which means that it will * silently (ie won't use @error) not log @message, when it won't be an - * instance ot TplLogEntryText, returning anyway %TRUE. This means "I could + * instance ot TplEntryText, returning anyway %TRUE. This means "I could * store @message, but I'm discarding it because I'm not interested in it" and * is not cosidered an error (@error won't be set). * It will return %FALSE with @error set if a fatal error occurred, for @@ -635,7 +635,7 @@ out: */ static gboolean tpl_log_store_sqlite_add_message (TplLogStore *self, - TplLogEntry *message, + TplEntry *message, GError **error) { gboolean retval = FALSE; @@ -648,10 +648,10 @@ tpl_log_store_sqlite_add_message (TplLogStore *self, "TplLogStoreSqlite intance needed"); goto out; } - if (!TPL_IS_LOG_ENTRY (message)) + if (!TPL_IS_ENTRY (message)) { g_set_error (error, TPL_LOG_STORE_ERROR, - TPL_LOG_STORE_ERROR_ADD_MESSAGE, "TplLogEntry instance needed"); + TPL_LOG_STORE_ERROR_ADD_MESSAGE, "TplEntry instance needed"); goto out; } @@ -674,7 +674,7 @@ out: static gboolean _insert_to_cache_table (TplLogStore *self, - TplLogEntry *message, + TplEntry *message, GError **error) { TplLogStoreSqlitePrivate *priv = GET_PRIV (self); @@ -686,7 +686,7 @@ _insert_to_cache_table (TplLogStore *self, gboolean retval = FALSE; int e; - if (!TPL_IS_LOG_ENTRY_TEXT (message)) + if (!TPL_IS_ENTRY_TEXT (message)) { g_set_error (error, TPL_LOG_STORE_ERROR, TPL_LOG_STORE_ERROR_ADD_MESSAGE, @@ -697,10 +697,10 @@ _insert_to_cache_table (TplLogStore *self, account = get_account_name_from_entry (message); channel = get_channel_name_from_entry (message); - identifier = _tpl_log_entry_get_chat_id (message); - log_id = _tpl_log_entry_get_log_id (message); - msg_id = tpl_log_entry_get_pending_msg_id (message); - chatroom = _tpl_log_entry_text_is_chatroom (TPL_LOG_ENTRY_TEXT (message)); + identifier = _tpl_entry_get_chat_id (message); + log_id = _tpl_entry_get_log_id (message); + msg_id = tpl_entry_get_pending_msg_id (message); + chatroom = _tpl_entry_text_is_chatroom (TPL_ENTRY_TEXT (message)); date = get_datetime (message); DEBUG ("channel = %s", channel); @@ -708,7 +708,7 @@ _insert_to_cache_table (TplLogStore *self, DEBUG ("chat_identifier = %s", identifier); DEBUG ("log_identifier = %s", log_id); DEBUG ("pending_msg_id = %d (%s)", msg_id, - (TPL_LOG_ENTRY_MSG_ID_IS_VALID (msg_id) ? + (TPL_ENTRY_MSG_ID_IS_VALID (msg_id) ? "pending" : "acknowledged or sent")); DEBUG ("chatroom = %i", chatroom); DEBUG ("date = %s", date); @@ -743,7 +743,7 @@ _insert_to_cache_table (TplLogStore *self, sqlite3_bind_text (sql, 2, account, -1, SQLITE_TRANSIENT); /* insert NULL if ACKNOWLEDGED (ie sent message's entries, which are created * ACK'd */ - if (!TPL_LOG_ENTRY_MSG_ID_IS_VALID (msg_id)) + if (!TPL_ENTRY_MSG_ID_IS_VALID (msg_id)) sqlite3_bind_null (sql, 3); else sqlite3_bind_int (sql, 3, msg_id); @@ -804,7 +804,7 @@ out: * specific TpChannel instance with the same path or not, just knowking its * path. * This is not a problem, though, since log-ids are unique within TPL. If two - * log-ids match, they relates to the same TplLogEntry instance. + * log-ids match, they relates to the same TplEntry instance. * * Returns: a list of log-id */ @@ -900,7 +900,7 @@ out: * specific TpChannel instance with the same path or not, just knowking its * path. * This is not a problem, though, since log-ids are unique within TPL. If two - * log-ids match, they relates to the same TplLogEntry instance. + * log-ids match, they relates to the same TplEntry instance. * * Returns: a list of log-id */ diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c index c6860a740..68eb53548 100644 --- a/telepathy-logger/log-store-xml.c +++ b/telepathy-logger/log-store-xml.c @@ -326,11 +326,11 @@ log_store_xml_get_timestamp_filename (void) static gchar * -log_store_xml_get_timestamp_from_message (TplLogEntry *message) +log_store_xml_get_timestamp_from_message (TplEntry *message) { time_t t; - t = tpl_log_entry_get_timestamp (message); + t = tpl_entry_get_timestamp (message); /* We keep the timestamps in the messages as UTC */ return _tpl_time_to_string_utc (t, LOG_TIME_FORMAT_FULL); @@ -366,7 +366,7 @@ log_store_xml_get_filename (TplLogStoreXml *self, /* this is a method used at the end of the add_message process, used by any - * LogEntry instance. it should the only method allowed to write to the + * Entry instance. it should the only method allowed to write to the * store */ static gboolean _log_store_xml_write_to_store (TplLogStoreXml *self, @@ -421,7 +421,7 @@ _log_store_xml_write_to_store (TplLogStoreXml *self, static gboolean add_message_text_chat (TplLogStoreXml *self, - TplLogEntryText *message, + TplEntryText *message, GError **error) { gboolean ret = FALSE; @@ -439,7 +439,7 @@ add_message_text_chat (TplLogStoreXml *self, g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (TPL_IS_LOG_STORE_XML (self), FALSE); - g_return_val_if_fail (TPL_IS_LOG_ENTRY_TEXT (message), FALSE); + g_return_val_if_fail (TPL_IS_ENTRY_TEXT (message), FALSE); bus_daemon = tp_dbus_daemon_dup (error); if (bus_daemon == NULL) @@ -449,23 +449,23 @@ add_message_text_chat (TplLogStoreXml *self, } account = tp_account_new (bus_daemon, - tpl_log_entry_get_account_path (TPL_LOG_ENTRY (message)), error); + tpl_entry_get_account_path (TPL_ENTRY (message)), error); if (account == NULL) { DEBUG ("Error acquiring TpAccount proxy: %s", (*error)->message); goto out; } - body_str = tpl_log_entry_text_get_message (message); + body_str = tpl_entry_text_get_message (message); if (TPL_STR_EMPTY (body_str)) goto out; body = g_markup_escape_text (body_str, -1); - msg_type = _tpl_log_entry_text_get_message_type (message); + msg_type = _tpl_entry_text_get_message_type (message); timestamp = log_store_xml_get_timestamp_from_message ( - TPL_LOG_ENTRY (message)); + TPL_ENTRY (message)); - sender = tpl_log_entry_get_sender (TPL_LOG_ENTRY (message)); + sender = tpl_entry_get_sender (TPL_ENTRY (message)); contact_id = g_markup_escape_text (tpl_contact_get_identifier (sender), -1); if (tpl_contact_get_alias (sender) != NULL) contact_name = g_markup_escape_text (tpl_contact_get_alias (sender), -1); @@ -476,21 +476,21 @@ add_message_text_chat (TplLogStoreXml *self, entry = g_strdup_printf ("" "%s\n" LOG_FOOTER, timestamp, - _tpl_log_entry_get_log_id (TPL_LOG_ENTRY (message)), + _tpl_entry_get_log_id (TPL_ENTRY (message)), contact_id, contact_name, avatar_token ? avatar_token : "", tpl_contact_get_contact_type (sender) == TPL_CONTACT_USER ? "true" : "false", - _tpl_log_entry_text_message_type_to_str (msg_type), + _tpl_entry_text_message_type_to_str (msg_type), body); DEBUG ("writing %s from %s (ts %s)", - _tpl_log_entry_get_log_id (TPL_LOG_ENTRY (message)), + _tpl_entry_get_log_id (TPL_ENTRY (message)), contact_id, timestamp); ret = _log_store_xml_write_to_store (self, account, - _tpl_log_entry_get_chat_id (TPL_LOG_ENTRY (message)), - _tpl_log_entry_text_is_chatroom (message), + _tpl_entry_get_chat_id (TPL_ENTRY (message)), + _tpl_entry_text_is_chatroom (message), entry, error); out: @@ -512,63 +512,63 @@ out: static gboolean add_message_text (TplLogStoreXml *self, - TplLogEntryText *message, + TplEntryText *message, GError **error) { - TplLogEntryTextSignalType signal_type; + TplEntryTextSignalType signal_type; g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (TPL_IS_LOG_STORE_XML (self), FALSE); - g_return_val_if_fail (TPL_IS_LOG_ENTRY_TEXT (message), FALSE); + g_return_val_if_fail (TPL_IS_ENTRY_TEXT (message), FALSE); - signal_type = _tpl_log_entry_get_signal_type (TPL_LOG_ENTRY (message)); + signal_type = _tpl_entry_get_signal_type (TPL_ENTRY (message)); switch (signal_type) { - case TPL_LOG_ENTRY_TEXT_SIGNAL_SENT: - case TPL_LOG_ENTRY_TEXT_SIGNAL_RECEIVED: + case TPL_ENTRY_TEXT_SIGNAL_SENT: + case TPL_ENTRY_TEXT_SIGNAL_RECEIVED: return add_message_text_chat (self, message, error); break; - case TPL_LOG_ENTRY_TEXT_SIGNAL_CHAT_STATUS_CHANGED: + case TPL_ENTRY_TEXT_SIGNAL_CHAT_STATUS_CHANGED: g_warning ("STATUS_CHANGED log entry not currently handled"); return FALSE; break; - case TPL_LOG_ENTRY_TEXT_SIGNAL_SEND_ERROR: + case TPL_ENTRY_TEXT_SIGNAL_SEND_ERROR: g_warning ("SEND_ERROR log entry not currently handled"); return FALSE; - case TPL_LOG_ENTRY_TEXT_SIGNAL_LOST_MESSAGE: + case TPL_ENTRY_TEXT_SIGNAL_LOST_MESSAGE: g_warning ("LOST_MESSAGE log entry not currently handled"); return FALSE; default: - g_warning ("LogEntry's signal type unknown"); + g_warning ("Entry's signal type unknown"); return FALSE; } } -/* First of two phases selection: understand the type LogEntry */ +/* First of two phases selection: understand the type Entry */ static gboolean log_store_xml_add_message (TplLogStore *store, - TplLogEntry *message, + TplEntry *message, GError **error) { TplLogStoreXml *self = TPL_LOG_STORE_XML (store); - g_return_val_if_fail (TPL_IS_LOG_ENTRY (message), FALSE); + g_return_val_if_fail (TPL_IS_ENTRY (message), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - switch (_tpl_log_entry_get_signal_type (TPL_LOG_ENTRY (message))) + switch (_tpl_entry_get_signal_type (TPL_ENTRY (message))) { - case TPL_LOG_ENTRY_CHANNEL_TEXT_SIGNAL_SENT: - case TPL_LOG_ENTRY_CHANNEL_TEXT_SIGNAL_RECEIVED: - case TPL_LOG_ENTRY_CHANNEL_TEXT_SIGNAL_SEND_ERROR: - case TPL_LOG_ENTRY_CHANELL_TEXT_SIGNAL_LOST_MESSAGE: - return add_message_text (self, TPL_LOG_ENTRY_TEXT (message), error); + case TPL_ENTRY_CHANNEL_TEXT_SIGNAL_SENT: + case TPL_ENTRY_CHANNEL_TEXT_SIGNAL_RECEIVED: + case TPL_ENTRY_CHANNEL_TEXT_SIGNAL_SEND_ERROR: + case TPL_ENTRY_CHANELL_TEXT_SIGNAL_LOST_MESSAGE: + return add_message_text (self, TPL_ENTRY_TEXT (message), error); default: - DEBUG ("TplLogEntrySignalType not handled by this LogStore (%s). " - "Ignoring LogEntry", log_store_xml_get_name (store)); + DEBUG ("TplEntrySignalType not handled by this LogStore (%s). " + "Ignoring Entry", log_store_xml_get_name (store)); /* do not consider it an error, this LogStore simply do not want/need - * this LogEntry */ + * this Entry */ return TRUE; } } @@ -766,7 +766,7 @@ log_store_xml_search_hit_new (TplLogStoreXml *self, return hit; } -/* returns a Glist of TplLogEntryText instances */ +/* returns a Glist of TplEntryText instances */ static GList * log_store_xml_get_messages_for_file (TplLogStoreXml *self, TpAccount *account, @@ -814,7 +814,7 @@ log_store_xml_get_messages_for_file (TplLogStoreXml *self, /* Now get the messages. */ for (node = log_node->children; node; node = node->next) { - TplLogEntryText *message; + TplEntryText *message; TplContact *sender; gchar *time_; time_t t; @@ -849,14 +849,14 @@ log_store_xml_get_messages_for_file (TplLogStoreXml *self, is_user = (!tp_strdiff (is_user_str, "true")); if (msg_type_str != NULL) - msg_type = _tpl_log_entry_text_message_type_from_str (msg_type_str); + msg_type = _tpl_entry_text_message_type_from_str (msg_type_str); if (log_id != NULL && self->priv->empathy_legacy) /* in legacy mode, it's actually the pending message id before ACK */ pending_id = atoi (log_id); else /* we have no way in non empathy-legacy mode to know it */ - pending_id = TPL_LOG_ENTRY_MSG_ID_UNKNOWN; + pending_id = TPL_ENTRY_MSG_ID_UNKNOWN; t = _tpl_time_parse (time_); @@ -879,14 +879,14 @@ log_store_xml_get_messages_for_file (TplLogStoreXml *self, g_free (instead_of_channel_path); } - message = _tpl_log_entry_text_new (log_id, - tp_proxy_get_object_path (account), TPL_LOG_ENTRY_DIRECTION_NONE); + message = _tpl_entry_text_new (log_id, + tp_proxy_get_object_path (account), TPL_ENTRY_DIRECTION_NONE); - _tpl_log_entry_set_pending_msg_id (TPL_LOG_ENTRY (message), pending_id); - _tpl_log_entry_set_sender (TPL_LOG_ENTRY (message), sender); - _tpl_log_entry_set_timestamp (TPL_LOG_ENTRY (message), t); - _tpl_log_entry_text_set_message (message, body); - _tpl_log_entry_text_set_message_type (message, msg_type); + _tpl_entry_set_pending_msg_id (TPL_ENTRY (message), pending_id); + _tpl_entry_set_sender (TPL_ENTRY (message), sender); + _tpl_entry_set_timestamp (TPL_ENTRY (message), t); + _tpl_entry_text_set_message (message, body); + _tpl_entry_text_set_message_type (message, msg_type); messages = g_list_append (messages, message); @@ -1113,7 +1113,7 @@ log_store_xml_get_chats_for_dir (TplLogStoreXml *self, } -/* returns a Glist of TplLogEntryText instances */ +/* returns a Glist of TplEntryText instances */ static GList * log_store_xml_get_messages_for_date (TplLogStore *store, TpAccount *account, diff --git a/telepathy-logger/log-store.c b/telepathy-logger/log-store.c index b01a4fa80..0ef61272e 100644 --- a/telepathy-logger/log-store.c +++ b/telepathy-logger/log-store.c @@ -33,7 +33,7 @@ * @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 + * @see_also: #entry-text:TplEntryText 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. @@ -137,7 +137,7 @@ _tpl_log_store_exists (TplLogStore *self, /** * _tpl_log_store_add_message: * @self: a TplLogStore - * @message: an instance of a subclass of TplLogEntry (ie TplLogEntryText) + * @message: an instance of a subclass of TplEntry (ie TplEntryText) * @error: memory location used if an error occurs * * Sends @message to the LogStore @self, in order to be stored. @@ -146,7 +146,7 @@ _tpl_log_store_exists (TplLogStore *self, */ gboolean _tpl_log_store_add_message (TplLogStore *self, - TplLogEntry *message, + TplEntry *message, GError **error) { g_return_val_if_fail (TPL_IS_LOG_STORE (self), FALSE); @@ -206,7 +206,7 @@ _tpl_log_store_get_dates (TplLogStore *self, * * Retrieves a list of text messages, with timestamp matching @date. * - * Returns: a GList of TplLogEntryText, to be freed using something like + * Returns: a GList of TplEntryText, to be freed using something like * g_list_foreach (lst, g_object_unref, NULL); * g_list_free (lst); */ @@ -333,7 +333,7 @@ _tpl_log_store_search_new (TplLogStore *self, * It will return at most the last (ie most recent) @num_messages messages. * Pass G_MAXUINT if all the message are needed. * - * Returns: a GList of TplLogEntryText, to be freed using something like + * Returns: a GList of TplEntryText, to be freed using something like * g_list_foreach (lst, g_object_unref, NULL); * g_list_free (lst); */ diff --git a/tests/test-tpl-log-entry.c b/tests/test-tpl-log-entry.c index 92a3fe562..f7d27d74c 100644 --- a/tests/test-tpl-log-entry.c +++ b/tests/test-tpl-log-entry.c @@ -6,15 +6,15 @@ #define LOG_ID "0" #define ACCOUNT_PATH "/org/freedesktop/Telepathy/Account/FOO/BAR/BAZ" #define CHAT_ID "echo@test.collabora.co.uk" -#define DIRECTION TPL_LOG_ENTRY_DIRECTION_IN +#define DIRECTION TPL_ENTRY_DIRECTION_IN int main (int argc, char **argv) { - TplLogEntryText *log; + TplEntryText *log; g_type_init (); - log = _tpl_log_entry_text_new (LOG_ID, ACCOUNT_PATH, DIRECTION); + log = _tpl_entry_text_new (LOG_ID, ACCOUNT_PATH, DIRECTION); return 0; diff --git a/tests/test-tpl-log-manager.c b/tests/test-tpl-log-manager.c index 0ad39b4b8..01739dfdc 100644 --- a/tests/test-tpl-log-manager.c +++ b/tests/test-tpl-log-manager.c @@ -4,7 +4,7 @@ #define LOG_ID 0 #define CHAT_ID "echo@test.collabora.co.uk" -#define DIRECTION TPL_LOG_ENTRY_DIRECTION_IN +#define DIRECTION TPL_ENTRY_DIRECTION_IN int main (int argc, char **argv) { -- cgit v1.2.3