+2007-06-13 Murray Cumming <murrayc@murrayc.com>
+
+ * libmodest-dbus-client/libmodest-dbus-client.c:
+ (libmodest_dbus_client_send_mail), (libmodest_dbus_client_mail_to),
+ (libmodest_dbus_client_compose_mail),
+ (libmodest_dbus_client_open_message),
+ (libmodest_dbus_client_send_and_receive),
+ (libmodest_dbus_client_open_default_inbox): Improved debug messages.
+
+ * src/dbus_api/modest-dbus-callbacks.c: (find_message_by_url),
+ (on_idle_open_message), (modest_dbus_req_handler),
+ (search_result_to_message), (modest_dbus_req_filter):
+ * src/modest-search.c: (add_hit), (modest_search_folder),
+ (modest_search_all_accounts): Improved debug messages.
+
+ * tests/dbus_api/test_open_message.c: (main): Improved comments.
+
+ * src/modest-tny-account-store.c:
+ (modest_tny_account_store_get_tny_account_by): Initialize a variable to
+ fix the build.
+
+2007-06-13 Murray Cumming <murrayc@murrayc.com>
+
+
2007-06-12 Murray Cumming <murrayc@murrayc.com>
* src/modest-tny-account-store.c: (get_server_accounts):
DBUS_TYPE_INVALID);
if (ret != OSSO_OK) {
- printf("debug: osso_rpc_run() failed.\n");
+ printf("debug: %s: osso_rpc_run() failed.\n", __FUNCTION__);
return FALSE;
} else {
- printf("debug: osso_rpc_run() succeeded.\n");
+ printf("debug: %s: osso_rpc_run() succeeded.\n", __FUNCTION__);
}
osso_rpc_free_val(&retval);
DBUS_TYPE_INVALID);
if (ret != OSSO_OK) {
- printf("debug: osso_rpc_run() failed.\n");
+ printf("debug: %s: osso_rpc_run() failed.\n", __FUNCTION__);
return FALSE;
} else {
- printf("debug: osso_rpc_run() succeeded.\n");
+ printf("debug: %s: osso_rpc_run() succeeded.\n", __FUNCTION__);
}
osso_rpc_free_val(&retval);
DBUS_TYPE_INVALID);
if (ret != OSSO_OK) {
- printf("debug: osso_rpc_run() failed.\n");
+ printf("debug: %s: osso_rpc_run() failed.\n", __FUNCTION__);
return FALSE;
} else {
- printf("debug: osso_rpc_run() succeeded.\n");
+ printf("debug: %s: osso_rpc_run() succeeded.\n", __FUNCTION__);
}
osso_rpc_free_val(&retval);
}
/**
- * libmodest_dbus_client_dopen_message:
+ * libmodest_dbus_client_open_message:
* @osso_context: a valid #osso_context_t object.
* @msg_uri: A valid url to a mail
*
DBUS_TYPE_INVALID);
if (ret != OSSO_OK) {
- printf("debug: osso_rpc_run() failed.\n");
+ printf("debug: %s: osso_rpc_run() failed.\n", __FUNCTION__);
return FALSE;
} else {
- printf("debug: osso_rpc_run() succeeded.\n");
+ printf("debug: %s: osso_rpc_run() succeeded.\n", __FUNCTION__);
}
osso_rpc_free_val(&retval);
DBUS_TYPE_INVALID);
if (ret != OSSO_OK) {
- printf("debug: osso_rpc_run() failed.\n");
+ printf("debug: %s: osso_rpc_run() failed.\n", __FUNCTION__);
return FALSE;
} else {
- printf("debug: osso_rpc_run() succeeded.\n");
+ printf("debug: %s: osso_rpc_run() succeeded.\n", __FUNCTION__);
}
osso_rpc_free_val(&retval);
DBUS_TYPE_INVALID);
if (ret != OSSO_OK) {
- printf("debug: osso_rpc_run() failed.\n");
+ printf("debug: %s: osso_rpc_run() failed.\n", __FUNCTION__);
return FALSE;
} else {
- printf("debug: osso_rpc_run() succeeded.\n");
+ printf("debug: %s: osso_rpc_run() succeeded.\n", __FUNCTION__);
}
osso_rpc_free_val(&retval);
static TnyMsg *
find_message_by_url (const char *uri, TnyAccount **ac_out)
{
-
ModestTnyAccountStore *astore;
TnyAccount *account;
TnyFolder *folder;
if (astore == NULL) {
return NULL;
}
-
- g_debug ("Got AccountStore, lets go");
account = tny_account_store_find_account (TNY_ACCOUNT_STORE (astore),
uri);
if (account == NULL) {
+ g_debug ("%s: tny_account_store_find_account() failed.\n", __FUNCTION__);
return NULL;
}
- g_debug ("Found account");
+ g_debug ("%s: Found account.\n", __FUNCTION__);
if ( ! TNY_IS_STORE_ACCOUNT (account)) {
goto out;
}
- g_debug ("Account is store account");
+ g_debug ("%s: Account is store account.\n", __FUNCTION__);
*ac_out = account;
NULL);
if (folder == NULL) {
+ g_debug ("%s: tny_store_account_find_folder() failed.\n", __FUNCTION__);
goto out;
}
- g_debug ("Found folder");
+ g_debug ("%s: Found folder.\n", __FUNCTION__);
msg = tny_folder_find_msg (folder, uri, NULL);
+
+ if (!msg) {
+ g_debug ("%s: tny_folder_find_msg() failed.\n", __FUNCTION__);
+ }
out:
if (account && !msg) {
uri = (char *) user_data;
- g_debug ("Trying to find msg by url: %s", uri);
+ g_debug ("%s: Trying to find msg by url: %s", __FUNCTION__, uri);
msg = find_message_by_url (uri, &account);
g_free (uri);
if (msg == NULL) {
+ g_debug (" %s: message not found.", __FUNCTION__);
return FALSE;
}
- g_debug ("Found message");
+ g_debug (" %s: Found message.", __FUNCTION__);
header = tny_msg_get_header (msg);
account_name = tny_account_get_name (account);
osso_rpc_t * retval)
{
- g_debug ("modest_dbus_req_handler()\n");
- g_debug ("debug: method received: %s\n", method);
+ g_debug ("debug: %s\n", __FUNCTION__);
+ g_debug ("debug: %s: method received: %s\n", __FUNCTION__, method);
if (g_ascii_strcasecmp(method, MODEST_DBUS_METHOD_SEND_MAIL) == 0) {
return on_send_mail (arguments, data, retval);
DBUS_STRUCT_END_CHAR_AS_STRING
static DBusMessage *
-search_result_to_messsage (DBusMessage *reply,
+search_result_to_message (DBusMessage *reply,
GList *hits)
{
DBusMessageIter iter;
is_unread = hit->is_unread;
ts = hit->timestamp;
- g_debug ("Adding hit: %s", msg_url);
+ g_debug ("DEBUG: %s: Adding hit: %s", __FUNCTION__, msg_url);
dbus_message_iter_open_container (&array_iter,
DBUS_TYPE_STRUCT,
reply = dbus_message_new_method_return (message);
- search_result_to_messsage (reply, hits);
+ search_result_to_message (reply, hits);
if (reply == NULL) {
g_warning ("Could not create reply");
hit = g_slice_new0 (ModestSearchHit);
furl = tny_folder_get_url_string (folder);
+ if (!furl) {
+ g_warning ("%s: tny_folder_get_url_string(): returned NULL for folder. Folder name=%s\n", __FUNCTION__, tny_folder_get_name (folder));
+ }
+
+ /* Make sure that we use the short UID instead of the long UID,
+ * and/or find out what UID form is used when finding, in camel_data_cache_get().
+ * so we can find what we get. Philip is working on this.
+ */
uid = tny_header_get_uid (header);
+ if (!furl) {
+ g_warning ("%s: tny_header_get_uid(): returned NULL for message with subject=%s\n", __FUNCTION__, tny_header_get_subject (header));
+ }
+
msg_url = g_strdup_printf ("%s/%s", furl, uid);
+
subject = tny_header_get_subject (header);
sender = tny_header_get_from (header);
hit->msgid = msg_url;
hit->subject = g_strdup_or_null (subject);
hit->sender = g_strdup_or_null (sender);
- hit->folder = furl;
+ hit->folder = furl; /* We just provide our new instance instead of copying it and freeing it. */
hit->msize = tny_header_get_message_size (header);
hit->has_attachment = flags & TNY_HEADER_FLAG_ATTACHMENTS;
hit->is_unread = ! (flags & TNY_HEADER_FLAG_SEEN);
hit->timestamp = tny_header_get_date_received (header);
-
+
return g_list_prepend (list, hit);
}
msg = tny_folder_get_msg (folder, cur, &err);
if (err != NULL || msg == NULL) {
- g_warning ("Could not get message\n");
+ g_warning ("%s: Could not get message.\n", __FUNCTION__);
g_error_free (err);
if (msg) {
account = TNY_ACCOUNT (tny_iterator_get_current (iter));
- g_debug ("Searching account %s",
- tny_account_get_name (account));
+ g_debug ("DEBUG: %s: Searching account %s",
+ __FUNCTION__, tny_account_get_name (account));
res = modest_search_account (account, search);
if (res != NULL) {
TnyAccount *account = NULL;
ModestTnyAccountStorePrivate *priv;
GSList *cursor;
- const gchar *val;
+ const gchar *val = NULL;
g_return_val_if_fail (self, NULL);
g_return_val_if_fail (str, NULL);
val = tny_account_get_url_string (TNY_ACCOUNT(cursor->data));
break;
}
+
if (type == MODEST_TNY_ACCOUNT_STORE_QUERY_URL &&
tny_account_matches_url_string (TNY_ACCOUNT(cursor->data), val)) {
account = TNY_ACCOUNT (cursor->data);
val = tny_account_get_url_string (TNY_ACCOUNT(cursor->data));
break;
}
+
if (type == MODEST_TNY_ACCOUNT_STORE_QUERY_URL &&
tny_account_matches_url_string (TNY_ACCOUNT(cursor->data), val)) {
account = TNY_ACCOUNT (cursor->data);
return -1;
}
+ /* For instance,
+ * "pop://murray.cumming%40gmail.com@pop.gmail.com:995/;use_ssl=wrapped/inbox/GmailId112e166949157685"
+ */
if (argc == 2) {
url = argv[1];
} else {
- url = "local://???FIXME???";
+ /* TODO: Add some test DBus method to get a valid URL for a message,
+ * just so we can test this method. */
+ g_printerr ("No email URL argument supplied on the command line.\n");
+ return -1;
}
g_print ("Trying to open msg: %s\n", url);