}
else {
if (bl->priv->ldap_search_filter && *bl->priv->ldap_search_filter
- && g_ascii_strncasecmp(bl->priv->ldap_search_filter,"(objectClass=*)",sizeof(bl->priv->ldap_search_filter))) {
+ && g_ascii_strcasecmp (bl->priv->ldap_search_filter, "(objectClass=*)") != 0) {
strings = g_new0 (gchar *, 5);
strings[0] = g_strdup ("(&");
strings[1] = g_strdup_printf ("%s", bl->priv->ldap_search_filter);
if (rc != 0) {/* rc == 0 means timeout exceeded */
if (rc == -1) {
EDataBookView *book_view = find_book_view (bl);
- g_warning ("ldap_result returned -1, restarting ops");
+ g_warning ("%s: ldap_result returned -1, restarting ops", G_STRFUNC);
- e_book_backend_ldap_reconnect (bl, book_view, LDAP_SERVER_DOWN);
+ if (!e_book_backend_ldap_reconnect (bl, book_view, LDAP_SERVER_DOWN)) {
+ g_warning ("%s: Failed to reconnect to LDAP server", G_STRFUNC);
+ return FALSE;
+ }
#if 0
if (bl->priv->connected)
restart_ops (bl);
g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
- view_limit = -1;
- if (view_limit == -1 || view_limit > bl->priv->ldap_limit)
- view_limit = bl->priv->ldap_limit;
+ view_limit = bl->priv->ldap_limit;
+ /* if (view_limit == -1 || view_limit > bl->priv->ldap_limit)
+ view_limit = bl->priv->ldap_limit; */
if (enable_debug)
printf ("searching server using filter: %s (expecting max %d results)\n", ldap_query, view_limit);
g_ptr_array_add (qs, q);
q = va_arg (ap, EBookQuery *);
}
- va_end (ap);
ret->type = type;
ret->query.andor.nqs = qs->len;
EBookQuery *
e_book_query_andv (EBookQuery *q, ...)
{
+ EBookQuery *res;
va_list ap;
va_start (ap, q);
- return conjoinv (E_BOOK_QUERY_TYPE_AND, q, ap);
+ res = conjoinv (E_BOOK_QUERY_TYPE_AND, q, ap);
+ va_end (ap);
+
+ return res;
}
/**
EBookQuery *
e_book_query_orv (EBookQuery *q, ...)
{
+ EBookQuery *res;
va_list ap;
va_start (ap, q);
- return conjoinv (E_BOOK_QUERY_TYPE_OR, q, ap);
+ res = conjoinv (E_BOOK_QUERY_TYPE_OR, q, ap);
+ va_end (ap);
+
+ return res;
}
/**
const gchar *
e_contact_field_name (EContactField field_id)
{
- g_return_val_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST, "");
+ g_return_val_if_fail (field_id >= 1 && field_id < E_CONTACT_FIELD_LAST, "");
return field_info[field_id].field_name;
}
const gchar *
e_contact_pretty_name (EContactField field_id)
{
- g_return_val_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST, "");
+ g_return_val_if_fail (field_id >= 1 && field_id < E_CONTACT_FIELD_LAST, "");
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
const gchar *
e_contact_vcard_attribute (EContactField field_id)
{
- g_return_val_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST, "");
+ g_return_val_if_fail (field_id >= 1 && field_id < E_CONTACT_FIELD_LAST, "");
return field_info[field_id].vcard_field_name;
}
const EContactFieldInfo *info = NULL;
g_return_val_if_fail (contact && E_IS_CONTACT (contact), NULL);
- g_return_val_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST, NULL);
+ g_return_val_if_fail (field_id >= 1 && field_id < E_CONTACT_FIELD_LAST, NULL);
info = &field_info[field_id];
gpointer value = NULL;
g_return_val_if_fail (E_IS_CONTACT (contact), NULL);
+ g_return_val_if_fail (field_id >= 1 && field_id < E_CONTACT_FIELD_LAST, NULL);
g_return_val_if_fail (field_info[field_id].t & E_CONTACT_FIELD_TYPE_STRING, NULL);
value = contact->priv->cached_strings[field_id];
d(printf ("e_contact_set (%p, %d, %p)\n", contact, field_id, value));
g_return_if_fail (contact && E_IS_CONTACT (contact));
- g_return_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST);
+ g_return_if_fail (field_id >= 1 && field_id < E_CONTACT_FIELD_LAST);
/* set the cached slot to NULL so we'll re-get the new string
* if e_contact_get_const is called again */
const EContactFieldInfo *info = NULL;
g_return_val_if_fail (contact && E_IS_CONTACT (contact), NULL);
- g_return_val_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST, NULL);
+ g_return_val_if_fail (field_id >= 1 && field_id < E_CONTACT_FIELD_LAST, NULL);
info = &field_info[field_id];
GList *l;
g_return_if_fail (contact && E_IS_CONTACT (contact));
- g_return_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST);
+ g_return_if_fail (field_id >= 1 && field_id < E_CONTACT_FIELD_LAST);
info = &field_info[field_id];
g_return_val_if_fail (name_str != NULL, NULL);
name = e_contact_name_new ();
- western = e_name_western_parse (name_str ? name_str : "");
+ western = e_name_western_parse (name_str);
name->prefixes = g_strdup (western->prefix);
name->given = g_strdup (western->first );
* e_vcard_remove_attributes:
* @evc: vcard object
* @attr_group: (allow-none): group name of attributes to be removed
- * @attr_name: (allow-none): name of the arributes to be removed
+ * @attr_name: name of the arributes to be removed
*
* Removes all the attributes with group name and attribute name equal to
* passed in values. If @attr_group is %NULL or an empty string,
if (((!attr_group || *attr_group == '\0') ||
(attr_group && !g_ascii_strcasecmp (attr_group, a->group))) &&
- ((!attr_name && !a->name) || !g_ascii_strcasecmp (attr_name, a->name))) {
+ ((!a->name) || !g_ascii_strcasecmp (attr_name, a->name))) {
/* matches, remove/delete the attribute */
evc->priv->attributes = g_list_delete_link (evc->priv->attributes, attr);
string_to_dbt (const gchar *str,
DBT *dbt)
{
- memset (dbt, 0, sizeof (dbt));
+ memset (dbt, 0, sizeof (DBT));
dbt->data = (gpointer) str;
dbt->size = strlen (str) + 1;
dbt->flags = DB_DBT_USERMEM;
if (vcard_dbt.data && !strncmp (vcard_dbt.data, "BEGIN:VCARD", 11)) {
contact = e_contact_new_from_vcard (vcard_dbt.data);
- if (e_book_backend_sexp_match_contact (sexp, contact))
+ if (!sexp || e_book_backend_sexp_match_contact (sexp, contact))
list = g_list_prepend (list, contact);
else
g_object_unref (contact);
gchar *vcard_str = NULL, *sexp;
EBookQuery *q;
GSList *uids = NULL;
- gboolean store_vcard = FALSE;
g_print ("Creating the sqlitedb \n");
op = "create sqlitedb";
ebsdb = e_book_backend_sqlitedb_new
(cache_path, email, folderid, folder_name,
- store_vcard, &error);
+ FALSE, &error);
if (error)
goto exit;
if (error)
goto exit;
- if (store_vcard) {
+ /* if (store_vcard) {
q = e_book_query_any_field_contains ("word");
sexp = e_book_query_to_string (q);
search_db (ebsdb, "full_search query", sexp);
g_free (sexp);
if (error)
goto exit;
- }
+ } */
g_print ("Delete contact \n");
op = "delete contact";
res = g_strdup (r->value.string);
else
res = NULL;
- } else
+ } else {
g_warn_if_reached ();
+ res = NULL;
+ }
e_sexp_result_free (sexp, r);
e_sexp_unref (sexp);
lose:
if (fp)
fclose (fp);
- if (new_filename)
- g_unlink (new_filename);
+ g_unlink (new_filename);
g_free (new_filename);
return FALSE;
}
nsdav = xmlNewNs (root, (xmlChar *) "DAV:", NULL);
node = xmlNewTextChild (root, nsdav, (xmlChar *) "prop", NULL);
- node = xmlNewTextChild (node, nsdav, (xmlChar *) "owner", NULL);
+ xmlNewTextChild (node, nsdav, (xmlChar *) "owner", NULL);
buf = xmlAllocOutputBuffer (NULL);
xmlNodeDumpOutput (buf, doc, root, 0, 1, NULL);
nscd = xmlNewNs (root, (xmlChar *) "urn:ietf:params:xml:ns:caldav", (xmlChar *) "C");
node = xmlNewTextChild (root, nsdav, (xmlChar *) "prop", NULL);
- node = xmlNewTextChild (node, nscd, (xmlChar *) "schedule-outbox-URL", NULL);
+ xmlNewTextChild (node, nscd, (xmlChar *) "schedule-outbox-URL", NULL);
buf = xmlAllocOutputBuffer (NULL);
xmlNodeDumpOutput (buf, doc, root, 0, 1, NULL);
soup_uri_free (suri);
}
+ g_return_val_if_fail (priv->uri != NULL, FALSE);
+
/* remove trailing slashes... */
len = strlen (priv->uri);
while (len--) {
prunning_by_time = e_cal_backend_sexp_evaluate_occur_times (sexp, &occur_start, &occur_end);
- bkend = E_CAL_BACKEND (backend);
-
list = prunning_by_time ?
e_cal_backend_store_get_components_occuring_in_range (priv->store, occur_start, occur_end)
: e_cal_backend_store_get_components (priv->store);
priv = cbc->priv;
+ if (!priv->addressbook_sources)
+ return NULL;
+
/* Create address books for existing sources */
for (i = e_source_list_peek_groups (priv->addressbook_sources); i; i = i->next) {
ESourceGroup *source_group = E_SOURCE_GROUP (i->data);
priv->update_alarms_id = 0;
}
- g_object_unref (priv->addressbook_sources);
+ if (priv->addressbook_sources)
+ g_object_unref (priv->addressbook_sources);
g_hash_table_destroy (priv->addressbooks);
g_hash_table_destroy (priv->credentials);
g_hash_table_destroy (priv->tracked_contacts);
priv = g_new0 (ECalBackendContactsPrivate, 1);
- e_book_client_get_sources (&priv->addressbook_sources, NULL);
+ if (!e_book_client_get_sources (&priv->addressbook_sources, NULL))
+ priv->addressbook_sources = NULL;
priv->addressbooks = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify) book_record_free);
GError *e = NULL;
GFile *file, *backup_file;
GFileOutputStream *stream;
+ gboolean succeeded;
gchar *tmp, *backup_uristr;
gchar *buf;
ECalBackendFile *cbfile = user_data;
}
buf = icalcomponent_as_ical_string_r (priv->icalcomp);
- g_output_stream_write_all (G_OUTPUT_STREAM (stream), buf, strlen (buf) * sizeof (gchar), NULL, NULL, &e);
+ succeeded = g_output_stream_write_all (G_OUTPUT_STREAM (stream), buf, strlen (buf) * sizeof (gchar), NULL, NULL, &e);
g_free (buf);
- if (e) {
+ if (!succeeded || e) {
g_object_unref (stream);
g_object_unref (file);
g_object_unref (backup_file);
goto error;
}
- g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, &e);
+ succeeded = g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, &e);
g_object_unref (stream);
- if (e) {
+ if (!succeeded || e) {
g_object_unref (file);
g_object_unref (backup_file);
goto error;
break;
case CALOBJ_MOD_ONLY_THIS:
case CALOBJ_MOD_THIS :
- obj_data = remove_instance (cbfile, obj_data, uid, recur_id, mod,
- old_component, new_component, error);
+ remove_instance (cbfile, obj_data, uid, recur_id, mod,
+ old_component, new_component, error);
break;
case CALOBJ_MOD_THISANDPRIOR :
case CALOBJ_MOD_THISANDFUTURE :
}
cbfile = g_object_new (E_TYPE_CAL_BACKEND_FILE, NULL);
- open_cal (cbfile, calendar_fname, NULL);
- if (cbfile == NULL)
- {
- g_message (G_STRLOC " Could not open calendar %s", calendar_fname);
+ open_cal (cbfile, calendar_fname, &error);
+ if (error != NULL) {
+ g_message (G_STRLOC " Could not open calendar %s: %s", calendar_fname, error->message);
exit (-1);
}
if (!obj_sexp)
return vfb;
- if (!obj_sexp)
- return vfb;
slist = e_cal_backend_store_get_components (store);
}
*objects = NULL;
- components = e_cal_backend_store_get_components (priv->store);
prunning_by_time = e_cal_backend_sexp_evaluate_occur_times (sexp,
- &occur_start,
- &occur_end);
+ &occur_start,
+ &occur_end);
components = prunning_by_time ?
e_cal_backend_store_get_components_occuring_in_range (priv->store, occur_start, occur_end)
try_again:
if (!e_cal_client_get_objects_for_uid_sync (client, uid, &objects, NULL, &error)) {
- if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_BUSY) && tries >= 10) {
+ if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_BUSY) && tries <= 10) {
tries++;
g_usleep (500);
g_clear_error (&error);
ECalComponentRange recur_id, instance_recur_id;
processed = FALSE;
+ recur_id.type = E_CAL_COMPONENT_RANGE_SINGLE;
+ instance_recur_id.type = E_CAL_COMPONENT_RANGE_SINGLE;
cid = dl->data;
e_cal_component_get_uid (cid->comp, &uid);
g_hash_table_insert (priv->timezones, (gpointer) icaltimezone_get_tzid (*zone), *zone);
UNLOCK_CACHE ();
- E_CALENDAR_CHECK_STATUS (status, error);
+ return TRUE;
}
/**
if (dt.value != NULL) {
zone = resolve_tzid (dt.tzid, ctx);
- result = e_sexp_result_new (esexp, ESEXP_RES_INT);
if (zone)
due_t = icaltime_as_timet_with_zone (*dt.value,zone);
else
return -1;
class = CAMEL_CERTDB_GET_CLASS (certdb);
+ if (!class->header_load || !class->cert_load) {
+ fclose (in);
+ in = NULL;
+ }
g_return_val_if_fail (class->header_load != NULL, -1);
g_return_val_if_fail (class->cert_load != NULL, -1);
}
class = CAMEL_CERTDB_GET_CLASS (certdb);
+ if (!class->header_save || !class->cert_save) {
+ fclose (out);
+ out = NULL;
+ }
g_return_val_if_fail (class->header_save != NULL, -1);
g_return_val_if_fail (class->cert_save != NULL, -1);
if (driver->priv->statusfunc) {
va_start (ap, desc);
str = g_strdup_vprintf (desc, ap);
+ va_end (ap);
driver->priv->statusfunc (driver, status, pc, str, driver->priv->statusdata);
g_free (str);
}
va_start (ap, desc);
str = g_strdup_vprintf (desc, ap);
+ va_end (ap);
}
switch (status) {
goto fail;
}
/* to get the filesize */
- fstat (fd, &st);
+ if (fstat (fd, &st) != 0)
+ st.st_size = 0;
mp = camel_mime_parser_new ();
camel_mime_parser_scan_from (mp, TRUE);
}
}
+ g_return_if_fail (mir != NULL);
+
if (!args->migration) {
if (camel_db_write_message_info_record (cdb, full_name, mir, error) != 0) {
- camel_db_camel_mir_free (mir);
- return;
+ camel_db_camel_mir_free (mir);
+ return;
}
} else {
if (camel_db_write_fresh_message_info_record (cdb, CAMEL_DB_IN_MEMORY_TABLE, mir, error) != 0) {
- camel_db_camel_mir_free (mir);
- return;
+ camel_db_camel_mir_free (mir);
+ return;
}
if (args->progress > CAMEL_DB_IN_MEMORY_TABLE_LIMIT) {
CamelFIRecord *record;
gint ret, count;
+ g_return_val_if_fail (summary != NULL, FALSE);
+
if (!(summary->flags & CAMEL_SUMMARY_DIRTY))
return TRUE;
record = g_new0 (CamelFIRecord, 1);
camel_db_read_folder_info_record (cdb, folder_name, record, error);
- if (record) {
- ret = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_from_db (summary, record);
- } else {
- ret = FALSE;
- }
+ ret = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_from_db (summary, record);
g_free (record->folder_name);
g_free (record->bdata);
async_context = g_simple_async_result_get_op_res_gpointer (simple);
/* Assume success unless a GError is set. */
- g_simple_async_result_propagate_error (simple, error);
-
- return async_context->success;
+ return !g_simple_async_result_propagate_error (simple, error)
+ && async_context->success;
}
static void
async_context = g_simple_async_result_get_op_res_gpointer (simple);
/* Assume success unless a GError is set. */
- g_simple_async_result_propagate_error (simple, error);
-
- return async_context->success;
+ return !g_simple_async_result_propagate_error (simple, error)
+ && async_context->success;
}
static void
i++;
}
- if (str && *str && i == 2) {
+ if (*str && i == 2) {
struct {
gint gpg_hash_algo;
CamelCipherHash camel_hash_algo;
/* We should fetch just 200 unquoted lines. */
while ((line = camel_stream_buffer_read_line ((CamelStreamBuffer *) bstream, NULL, NULL)) && str->len < 200) {
gchar *tmp = line;
- if (!line)
- continue;
if (*line == '>' || strstr(line, "wrote:")) {
g_free (tmp);
if (!encoded) {
gchar *ch;
- for (ch = value; *ch; ch++) {
+ for (ch = value; ch && *ch; ch++) {
if (camel_mime_is_tspecial (*ch) || camel_mime_is_lwsp (*ch))
break;
}
/* If no such key exists in the bag, create a reservation. */
reservation = key_reservation_lookup (bag, key);
if (reservation == NULL) {
- reservation = key_reservation_new (bag, key);
+ key_reservation_new (bag, key);
g_mutex_unlock (bag->mutex);
return NULL;
}
}
p = strrchr (name, '.');
- strcpy (p, "." G_MODULE_SUFFIX);
+ if (p)
+ strcpy (p, "." G_MODULE_SUFFIX);
m = g_malloc0 (sizeof (*m));
m->path = name;
for (c = (guchar *) sound; *c && !isalpha (*c); c++);
code[0] = toupper (*c);
- memset (code + 1, '0', 3);
+ memset (code + 1, 0, 3);
for (n = 1; *c && n < 5; c++) {
guchar ch = soundex_table[*c];
if (strlen (haystack) == 0)
return NULL;
- puni = nuni = g_alloca (sizeof (gunichar) * strlen (needle));
+ puni = nuni = g_alloca (sizeof (gunichar) * (strlen (needle) + 1));
+ nuni[0] = 0;
p = (const guchar *) needle;
while ((u = camel_utf8_getc (&p)))
}
camel_sexp_input_text (sexp, sql, strlen (sql));
- camel_sexp_parse (sexp);
+ if (camel_sexp_parse (sexp)) {
+ g_object_unref (sexp);
+ return NULL;
+ }
r = camel_sexp_eval (sexp);
if (!r) {
/* These should be normal tokens */
if (i >= G_N_ELEMENTS (elements)) {
- Node *pnode = operands->data;
+ Node *pnode;
+
+ g_return_val_if_fail (operands != NULL, NULL);
+ pnode = operands->data;
node = g_new0 (Node, 1);
node->token = g_strdup (token);
all = g_list_prepend (all, node);
} else if (token == '+') {
gchar *astr = NULL, *bstr = NULL;
- Node *node, *pnode = operands->data;
+ Node *node, *pnode;
gint lvl = 0, lval = 0;
+ g_return_val_if_fail (operands != NULL, NULL);
+ pnode = operands->data;
+
if (g_ascii_strcasecmp (pnode->token, "user-flag") == 0) {
/* Colloct all after '+' and append them to one token. Go till you find ')' */
token = g_scanner_get_next_token (scanner);
level--;
} else if (token == '-') {
gchar *bstr = NULL;
- Node *node, *pnode = operands->data;
+ Node *node, *pnode;
gint lvl = 0, lval = 0;
+ g_return_val_if_fail (operands != NULL, NULL);
+ pnode = operands->data;
+
/* Colloct all after '+' and append them to one token. Go till you find ')' */
token = g_scanner_get_next_token (scanner);
while (!g_scanner_eof (scanner) && lvl >=0 ) {
operators = g_list_prepend (operators, node);
all = g_list_prepend (all, node);
} else if (token == G_TOKEN_INT) {
- Node *pnode = operands->data, *node;
+ Node *pnode, *node;
+
+ g_return_val_if_fail (operands != NULL, NULL);
+ pnode = operands->data;
node = g_new0 (Node, 1);
node->token = g_strdup_printf ("%ld", scanner->value.v_int);
dbl = TRUE;
}
}
- str = g_strdup_printf("(%s %c%s %s)", n2->exact_token, prefix ? prefix : ' ', opnode->exact_token, n1->exact_token);
+ str = g_strdup_printf("(%s %c%s %s)", n2->exact_token, prefix ? prefix : ' ', opnode ? opnode->exact_token : "", n1->exact_token);
if (opnode) {
free_node (opnode);
JobData *job_data;
GError *error = NULL;
- g_simple_async_result_propagate_error (simple, &error);
+ g_warn_if_fail (g_simple_async_result_propagate_error (simple, &error));
job_data = g_simple_async_result_get_op_res_gpointer (simple);
g_signal_emit (
if (provider == NULL)
continue;
- if (provider == NULL)
- continue;
-
if (provider->url_equal == NULL)
continue;
io (printf ("Loading folder info\n"));
- camel_file_util_decode_string (in, &info->path);
- camel_file_util_decode_uint32 (in, &info->flags);
- camel_file_util_decode_uint32 (in, &info->unread);
- camel_file_util_decode_uint32 (in, &info->total);
+ if (camel_file_util_decode_string (in, &info->path) == -1 ||
+ camel_file_util_decode_uint32 (in, &info->flags) == -1 ||
+ camel_file_util_decode_uint32 (in, &info->unread) == -1 ||
+ camel_file_util_decode_uint32 (in, &info->total) == -1) {
+ camel_store_summary_info_free (summary, info);
+
+ return NULL;
+ }
/* Ok, brown paper bag bug - prior to version 2 of the file, flags are
* stored using the bit number, not the bit. Try to recover as best we can */
{
io (printf ("Saving folder info\n"));
- camel_file_util_encode_string (
- out, camel_store_info_path (summary, info));
- camel_file_util_encode_uint32 (out, info->flags);
- camel_file_util_encode_uint32 (out, info->unread);
- camel_file_util_encode_uint32 (out, info->total);
+ if (camel_file_util_encode_string (out, camel_store_info_path (summary, info)) == -1 ||
+ camel_file_util_encode_uint32 (out, info->flags) == -1 ||
+ camel_file_util_encode_uint32 (out, info->unread) == -1 ||
+ camel_file_util_encode_uint32 (out, info->total) == -1)
+ return -1;
return ferror (out);
}
* We need to rename them atomically with renaming the actual
* folder path. */
folders = camel_object_bag_list (store->folders);
- for (i = 0; i < folders->len; i++) {
+ for (i = 0; folders && i < folders->len; i++) {
const gchar *full_name;
folder = folders->pdata[i];
filename = g_build_filename (
g_get_home_dir (), ".camel_certs", fingerprint, NULL);
- g_file_get_contents (filename, &contents, &length, &error);
- if (error != NULL) {
+ if (!g_file_get_contents (filename, &contents, &length, &error) ||
+ error != NULL) {
g_warning (
"Could not load cert %s: %s",
- filename, error->message);
- g_error_free (error);
+ filename, error ? error->message : "Unknown error");
+ g_clear_error (&error);
camel_cert_set_trust (
certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN);
CAMEL_TEXT_INDEX_LOCK (idx, lock);
/* if we're adding words, up the cache limits a lot */
- if (p->blocks) {
+ if (p->word_cache_limit < 8192) {
p->blocks->block_cache_limit = 1024;
p->word_cache_limit = 8192;
}
always_changed = g_ptr_array_new ();
for (i = 0; i < changed->len; i++) {
uid = changed->pdata[i];
- if (strlen (uid) + 9 > vuidlen) {
+ if (!vuid || strlen (uid) + 9 > vuidlen) {
vuidlen = strlen (uid) + 64;
vuid = g_realloc (vuid, vuidlen);
}
/* Since the source of a correlating vfolder has to be requeried in
* full every time it changes, caching the results in the db is not
* worth the effort. Thus, DB use is conditioned on !correlating. */
- gboolean correlating = expression_is_correlating (vee_folder->expression);
+ gboolean correlating = vee_folder->expression && expression_is_correlating (vee_folder->expression);
if (vee_folder == folder_unmatched)
return 0;
if (!list1) {
for (flag = camel_message_info_user_flags (master_info); flag; flag = flag->next) {
- if (flag->name && *flag->name) {
+ if (*flag->name) {
count1++;
list1 = g_list_prepend (list1, (gchar *) flag->name);
}
}
for (flag = camel_message_info_user_flags (info); flag; flag = flag->next) {
- if (flag->name && *flag->name) {
+ if (*flag->name) {
count2++;
list2 = g_list_prepend (list2, (gchar *) flag->name);
}
g_return_val_if_fail (mi != NULL, FALSE);
message = camel_folder_get_message_sync (
- source, uid, cancellable, NULL);
+ source, uid, cancellable, &local_error);
if (message) {
camel_imap_summary_add_offline (
&& header.termcount == 0) {
d(printf(" found %d matches\n", header.matchcount));
g_array_set_size (mr->matches, header.matchcount);
- camel_stream_read (stream, mr->matches->data, sizeof (guint32) * header.matchcount, NULL, NULL);
+ if (camel_stream_read (stream, mr->matches->data, sizeof (guint32) * header.matchcount, NULL, NULL) == -1) {
+ memset (&header, 0, sizeof (header));
+ }
} else {
d(printf(" file format invalid/validity changed\n"));
memset (&header, 0, sizeof (header));
goto fail;
if (top[0] == 0) {
- pattern = g_alloca (2);
+ pattern = g_alloca (3);
pattern[0] = '*';
pattern[1] = 0;
i = 0;
/* FIXME: All the custom flags are sent to the server. Not just the changed ones */
flag = camel_message_info_user_flags (info);
while (flag) {
- if (flag->name && *flag->name) {
+ if (*flag->name) {
name = rename_label_flag (flag->name, strlen (flag->name), FALSE);
if (name && *name)
*flag_list_p = flag_list;
*flags_out = flags;
- if (custom_flags_out && custom_flags->len) {
+ if (custom_flags_out && custom_flags && custom_flags->len) {
*custom_flags_out = g_string_free (custom_flags, FALSE);
} else if (custom_flags)
g_string_free (custom_flags, TRUE);
ss->limit = limit;
}
-gint
+gboolean
imapx_uidset_done (struct _uidset_state *ss,
CamelIMAPXCommand *ic)
{
- gint ret = 0;
+ gint ret = FALSE;
if (ss->last != 0 && ss->last != ss->start) {
camel_imapx_command_add (ic, ":%d", ss->last);
if ((ss->limit && ss->entries >= ss->limit)
|| (ss->total && ss->uids >= ss->total)) {
e(ic->is->tagprefix, " done, %d entries, %d uids\n", ss->entries, ss->uids);
- imapx_uidset_done (ss, ic);
+ if (!imapx_uidset_done (ss, ic))
+ return -1;
return 1;
}
if (camel_imapx_command_set_error_if_failed (ic, &local_error)) {
GQueue failed = G_QUEUE_INIT;
GQueue trash = G_QUEUE_INIT;
- GList *head, *link;
+ GList *link;
c(is->tagprefix, "Select failed\n");
QUEUE_LOCK (is);
- head = camel_imapx_command_queue_peek_head_link (is->queue);
-
if (is->select_pending) {
- head = camel_imapx_command_queue_peek_head_link (is->queue);
+ GList *head = camel_imapx_command_queue_peek_head_link (is->queue);
for (link = head; link != NULL; link = g_list_next (link)) {
CamelIMAPXCommand *cw = link->data;
}
sasl = camel_sasl_new ("imap", mechanism, service);
- if (sasl != NULL) {
+ if (sasl == NULL) {
g_set_error (
error, CAMEL_SERVICE_ERROR,
CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
imapx_command_run_sync (is, ic, job->cancellable, &job->error);
- if (ic->job->error == NULL)
- camel_imapx_command_set_error_if_failed (ic, &ic->job->error);
-
- g_prefix_error (
- &ic->job->error, "%s: ",
- _("Error while fetching messages"));
+ if (ic->job->error != NULL || camel_imapx_command_set_error_if_failed (ic, &ic->job->error)) {
+ g_prefix_error (
+ &ic->job->error, "%s: ",
+ _("Error while fetching messages"));
+ }
camel_imapx_command_unref (ic);
}
if (!need_rescan) {
CamelIMAPXCommand *ic;
+ #if 0
if (is_selected) {
/* We may not issue STATUS on the current folder. Use SELECT or NOOP instead. */
if (0 /* server needs SELECT not just NOOP */) {
goto done;
}
}
- } else {
+ } else
+ #endif
+ {
if (is->cinfo->capa & IMAPX_CAPABILITY_CONDSTORE)
ic = camel_imapx_command_new (
is, "STATUS", NULL,
imapx_command_run_sync (
is, ic, job->cancellable, &job->error);
- if (ic->job->error == NULL)
- camel_imapx_command_set_error_if_failed (ic, &ic->job->error);
-
- g_prefix_error (
- &ic->job->error, "%s: ",
- _("Error refreshing folder"));
+ if (ic->job->error != NULL || camel_imapx_command_set_error_if_failed (ic, &ic->job->error)) {
+ g_prefix_error (
+ &ic->job->error, "%s: ",
+ _("Error refreshing folder"));
+ }
if (ic->job->error != NULL) {
camel_imapx_command_unref (ic);
imapx_command_run_sync (is, ic, job->cancellable, &job->error);
- if (ic->job->error == NULL)
- camel_imapx_command_set_error_if_failed (ic, &ic->job->error);
+ if (ic->job->error != NULL || camel_imapx_command_set_error_if_failed (ic, &ic->job->error)) {
+ g_prefix_error (
+ &ic->job->error, "%s: ",
+ _("Error refreshing folder"));
+ }
- g_prefix_error (
- &ic->job->error, "%s: ",
- _("Error refreshing folder"));
-
if (ic->job->error != NULL) {
camel_imapx_command_unref (ic);
goto done;
}
send = imapx_uidset_add (&ss, ic, camel_message_info_uid (info));
}
- if (send || (i == uids->len - 1 && imapx_uidset_done (&ss, ic))) {
+ if (send == 1 || (i == uids->len - 1 && imapx_uidset_done (&ss, ic))) {
job->commands++;
camel_imapx_command_add (ic, " %tFLAGS.SILENT (%t)", on?"+":"-", flags_table[j].name);
imapx_command_queue (is, ic);
ic->pri = job->pri;
}
- if (imapx_uidset_add (&ss, ic, camel_message_info_uid (info))
+ if (imapx_uidset_add (&ss, ic, camel_message_info_uid (info)) == 1
|| (i == c->infos->len - 1 && imapx_uidset_done (&ss, ic))) {
job->commands++;
camel_imapx_command_add (ic, " %tFLAGS.SILENT (%t)", on?"+":"-", c->name);
if (uflags) {
if (suflags)
res = strcmp (uflags->name, suflags->name);
- else if (uflags->name && *uflags->name)
+ else if (*uflags->name)
res = -1;
else {
uflags = uflags->next;
{
if (summary->namespaces)
camel_imapx_namespace_list_clear (summary->namespaces);
- summary->namespaces = camel_imapx_namespace_list_copy (summary->namespaces);
+ summary->namespaces = camel_imapx_namespace_list_copy (nsl);
}
tok = camel_imapx_stream_token (is, &token, &len, cancellable, &local_error);
if (tok == '(') {
+ struct _camel_header_address *addr, *group = NULL;
while (1) {
- struct _camel_header_address *addr, *group = NULL;
-
/* address ::= "(" addr_name SPACE addr_adl SPACE addr_mailbox
* SPACE addr_host ")" */
tok = camel_imapx_stream_token (is, &token, &len, cancellable, &local_error);
group = addr;
}
} else {
- addr->v.addr = g_strdup_printf("%s%s%s", mbox? mbox:"", host?"@":"", host?(gchar *)host:"");
+ addr->v.addr = g_strdup_printf ("%s@%s", mbox? mbox :"", (const gchar *) host);
g_free (mbox);
d(is->tagprefix, "adding address '%s'\n", addr->v.addr);
if (group != NULL)
struct _CamelMessageContentInfo * cinfo = NULL;
struct _CamelMessageContentInfo *subinfo, *last;
struct _CamelContentDisposition * dinfo = NULL;
- struct _CamelMessageInfo * minfo = NULL;
GError *local_error = NULL;
/* body ::= "(" body_type_1part / body_type_mpart ")" */
tok = camel_imapx_stream_token (is, &token, &len, cancellable, &local_error);
camel_imapx_stream_ungettoken (is, tok, token, len);
if (tok == '(') {
+ struct _CamelMessageInfo * minfo = NULL;
+
/* what do we do with the envelope?? */
minfo = imapx_parse_envelope (is, cancellable, &local_error);
/* what do we do with the message content info?? */
imapx_free_body (cinfo);
if (dinfo)
camel_content_disposition_unref (dinfo);
- if (minfo)
- camel_message_info_free (minfo);
return NULL;
}
d(printf("Appending message\n"));
/* If we can't lock, don't do anything */
- if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
+ if (!lf || camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
return FALSE;
/* add it to the summary/assign the uid, etc */
check_changed:
camel_local_folder_unlock (lf);
- if (lf && camel_folder_change_info_changed (lf->changes)) {
+ if (camel_folder_change_info_changed (lf->changes)) {
camel_folder_changed (folder, lf->changes);
camel_folder_change_info_clear (lf->changes);
}
d(printf("getting message: %s\n", uid));
- if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
+ if (!lf || camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
return NULL;
name = maildir_folder_get_filename (folder, uid, error);
g_strerror (errno));
goto error;
}
- tmpname = NULL;
camel_operation_pop_message (cancellable);
camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
if (fdout != -1)
close (fdout);
- if (tmpname)
- g_unlink (tmpname);
+ g_unlink (tmpname);
camel_operation_pop_message (cancellable);
camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
((CamelMessageInfo *) info)->dirty = TRUE;
fromline = camel_mime_parser_from_line (mp);
d(printf("Saving %s:%d\n", camel_message_info_uid(info), info->frompos));
- write (fdout, fromline, strlen (fromline));
+ g_warn_if_fail (write (fdout, fromline, strlen (fromline)) != -1);
}
if (info && info->info.info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV | CAMEL_MESSAGE_FOLDER_FLAGGED)) {
return 0;
error:
g_free (xevnew);
+ g_object_unref (mp);
- if (mp)
- g_object_unref (mp);
if (info)
camel_message_info_free ((CamelMessageInfo *) info);
d(printf("Appending message\n"));
/* If we can't lock, don't do anything */
- if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
+ if (!lf || camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
return FALSE;
/* add it to the summary/assign the uid, etc */
check_changed:
camel_local_folder_unlock (lf);
- if (lf && camel_folder_change_info_changed (lf->changes)) {
+ if (camel_folder_change_info_changed (lf->changes)) {
camel_folder_changed (folder, lf->changes);
camel_folder_change_info_clear (lf->changes);
}
d(printf("getting message: %s\n", uid));
- if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
+ if (!lf || camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, error) == -1)
return NULL;
/* get the message summary info */
camel_local_folder_unlock (lf);
- if (lf && camel_folder_change_info_changed (lf->changes)) {
+ if (camel_folder_change_info_changed (lf->changes)) {
camel_folder_changed (folder, lf->changes);
camel_folder_change_info_clear (lf->changes);
}
} else {
/* else scan for one - and create it too, to make sure */
do {
- if (fd != -1)
- close (fd);
uid = camel_folder_summary_next_uid (s);
name = g_strdup_printf("%s/%u", cls->folder_path, uid);
/* O_EXCL isn't guaranteed, sigh. Oh well, bad luck, mh has problems anyway */
_("Folder '%s' does not exist."),
folder_name);
} else {
- if (creat (name, 0600) == -1) {
+ gint fd = creat (name, 0600);
+ if (fd == -1) {
g_set_error (
error, G_IO_ERROR,
g_io_error_from_errno (errno),
_("Could not create folder '%s':\n%s"),
folder_name, g_strerror (errno));
} else {
+ close (fd);
folder = camel_spool_folder_new (
store, folder_name, flags,
cancellable, error);
if (fread (is->last_newslist, 1, NNTP_DATE_SIZE, in) < NNTP_DATE_SIZE)
return -1;
- camel_file_util_decode_fixed_int32 (in, &nil);
-
- return 0;
+ return camel_file_util_decode_fixed_int32 (in, &nil);
}
static gint
short_folder_names = camel_nntp_settings_get_short_folder_names (
CAMEL_NNTP_SETTINGS (settings));
- for (i = 0;(si = camel_store_summary_index ((CamelStoreSummary *) store->summary, i)); i++) {
+ for (i = 0; i < camel_store_summary_count ((CamelStoreSummary *) store->summary); i++) {
+ si = camel_store_summary_index ((CamelStoreSummary *) store->summary, i);
if (si == NULL)
continue;
CamelFolderChangeInfo *changes = NULL;
camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
- camel_nntp_command (store, cancellable, NULL, folder, &line, NULL);
- if (camel_folder_change_info_changed (folder->changes)) {
- changes = folder->changes;
- folder->changes = camel_folder_change_info_new ();
+ if (camel_nntp_command (store, cancellable, NULL, folder, &line, NULL) != -1) {
+ if (camel_folder_change_info_changed (folder->changes)) {
+ changes = folder->changes;
+ folder->changes = camel_folder_change_info_new ();
+ }
}
camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (changes) {
if (!last ||
strncmp (si->path, last->full_name, strlen (last->full_name)) != 0 ||
si->path[strlen (last->full_name)] != '.') {
+ gchar *dot;
tmpname = g_strdup (si->path);
- *(strchr(tmpname + toplen, '.')) = '\0';
+ dot = strchr(tmpname + toplen, '.');
+ if (dot)
+ *dot = '\0';
fi = nntp_folder_info_from_name (store, FALSE, tmpname);
if (!fi)
continue;
return -1;
/* Check for unprocessed data, !*/
- if (store->stream->mode == CAMEL_NNTP_STREAM_DATA) {
+ if (store->stream && store->stream->mode == CAMEL_NNTP_STREAM_DATA) {
g_warning("Unprocessed data left in stream, flushing");
while (camel_nntp_stream_getd (store->stream, (guchar **) &p, &u, cancellable, error) > 0)
;
gint newlen, oldlen;
guchar *e;
+ g_return_val_if_fail (is != NULL, -1);
+ g_return_val_if_fail (data != NULL, -1);
+ g_return_val_if_fail (len != NULL, -1);
+
if (is->mode == CAMEL_NNTP_STREAM_EOD) {
*data = is->linebuf;
*len = 0;
gint max;
guchar *end;
+ g_return_val_if_fail (is != NULL, -1);
+ g_return_val_if_fail (start != NULL, -1);
+ g_return_val_if_fail (len != NULL, -1);
+
*len = 0;
max = is->end - is->ptr;
camel_nntp_stream_set_mode (CamelNNTPStream *is,
camel_nntp_stream_mode_t mode)
{
+ g_return_if_fail (is != NULL);
+
is->mode = mode;
}
guchar *p, *e, *s;
gint state;
+ g_return_val_if_fail (is != NULL, -1);
+ g_return_val_if_fail (start != NULL, -1);
+ g_return_val_if_fail (len != NULL, -1);
+
*len = 0;
if (is->mode == CAMEL_NNTP_STREAM_EOD)
va_start (ap, fmt);
pc->data = g_strdup_vprintf (fmt, ap);
+ va_end (ap);
pc->state = CAMEL_POP3_COMMAND_IDLE;
/* TODO: what about write errors? */
pop3_folder_dispose (GObject *object)
{
CamelPOP3Folder *pop3_folder = CAMEL_POP3_FOLDER (object);
- CamelPOP3FolderInfo **fi = (CamelPOP3FolderInfo **) pop3_folder->uids->pdata;
CamelPOP3Store *pop3_store = NULL;
CamelStore *parent_store;
if (pop3_folder->uids) {
gint i;
+ CamelPOP3FolderInfo **fi = (CamelPOP3FolderInfo **) pop3_folder->uids->pdata;
gboolean is_online = camel_service_get_connection_status (CAMEL_SERVICE (parent_store)) == CAMEL_SERVICE_CONNECTED;
for (i = 0; i < pop3_folder->uids->len; i++, fi++) {
gboolean success = TRUE;
gchar *host;
guint32 flags = 0;
- gint clean_quit = TRUE;
gint ret;
settings = camel_service_get_settings (service);
goto exit;
}
- /* as soon as we send a STLS command, all hope is lost of a clean QUIT if problems arise */
- clean_quit = FALSE;
-
if (!(store->engine->capa & CAMEL_POP3_CAP_STLS)) {
g_set_error (
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
goto exit;
stls_exception:
- if (clean_quit) {
- /* try to disconnect cleanly */
+ /* as soon as we send a STLS command, all hope is lost of a clean QUIT if problems arise */
+ /* if (clean_quit) {
+ / * try to disconnect cleanly * /
pc = camel_pop3_engine_command_new (store->engine, 0, NULL, NULL, cancellable, NULL, "QUIT\r\n");
while (camel_pop3_engine_iterate (store->engine, NULL, cancellable, NULL) > 0)
;
camel_pop3_engine_command_free (store->engine, pc);
- }
+ }*/
g_object_unref (store->engine);
g_object_unref (tcp_stream);
{
CamelPOP3Command *pc;
- if (!camel_service_get_connection_status (CAMEL_SERVICE (store)) == CAMEL_SERVICE_CONNECTED) {
+ if (camel_service_get_connection_status (CAMEL_SERVICE (store)) != CAMEL_SERVICE_CONNECTED) {
g_set_error (
error, CAMEL_SERVICE_ERROR,
CAMEL_SERVICE_ERROR_UNAVAILABLE,
/* Child process */
nullfd = open ("/dev/null", O_RDWR);
dup2 (fd[0], STDIN_FILENO);
- /*dup2 (nullfd, STDOUT_FILENO);
- dup2 (nullfd, STDERR_FILENO);*/
- close (nullfd);
+ if (nullfd != -1) {
+ /*dup2 (nullfd, STDOUT_FILENO);
+ dup2 (nullfd, STDERR_FILENO);*/
+ close (nullfd);
+ }
close (fd[1]);
execv (SENDMAIL_PATH, (gchar **) argv);
g_variant_get (parameters, "(u&s&su)", &arg_opid, &dbus_error_name, &dbus_error_message, &arg_uint);
break;
default:
+ /* fix below too, if this is reached */
g_warning ("%s: Unknown E_GDBUS_TYPE %x", G_STRFUNC, signal_type);
return;
}
case E_GDBUS_TYPE_UINT:
g_signal_emit (proxy, signal_id, 0, arg_opid, arg_error, arg_uint);
break;
- default:
- g_warning ("%s: Unknown E_GDBUS_TYPE %x", G_STRFUNC, signal_type);
- break;
}
if (arg_error)
/* here can be only http or https and nothing else */
is_https = g_str_has_prefix (uri, "https://");
- res = g_strdup_printf ("%s://%s%s%s%s%s",
+ res = g_strdup_printf ("%s://%s%s%s@%s",
is_https ? "https" : "http",
- user ? user : "",
+ user,
pw ? ":" : "",
pw ? pw : "",
- (user || pw) ? "@" : "",
uri + strlen ("http://") + (is_https ? 1 : 0));
g_free (user);
if (book_client) {
contact = NULL;
- e_book_client_get_contact_sync (book_client, contact_uid, &contact, NULL, NULL);
+ g_warn_if_fail (e_book_client_get_contact_sync (book_client, contact_uid, &contact, NULL, NULL));
email_num = e_destination_get_email_num (destination);
e_destination_set_contact (destination, contact, email_num);
e_destination_set_client (destination, book_client);
* hardly a performance issue here since source lists
* are short. */
- gtk_tree_model_get_iter_first (model, &iter);
+ iter_valid = gtk_tree_model_get_iter_first (model, &iter);
for (groups = e_source_list_peek_groups (source_list);
groups != NULL; groups = groups->next) {
continue;
name = e_source_group_peek_name (groups->data);
- if (!gtk_list_store_iter_is_valid (store, &iter))
+ if (!iter_valid)
gtk_list_store_append (store, &iter);
gtk_list_store_set (
store, &iter,
COLUMN_SENSITIVE, FALSE,
COLUMN_SOURCE, groups->data,
-1);
- gtk_tree_model_iter_next (model, &iter);
+ iter_valid = gtk_tree_model_iter_next (model, &iter);
sources = e_source_group_peek_sources (groups->data);
visible = TRUE;
}
- if (!gtk_list_store_iter_is_valid (store, &iter))
+ if (!iter_valid)
gtk_list_store_append (store, &iter);
gtk_list_store_set (
store, &iter,
priv->uid_index, g_strdup (uid),
gtk_tree_row_reference_new (model, path));
gtk_tree_path_free (path);
- gtk_tree_model_iter_next (model, &iter);
+ iter_valid = gtk_tree_model_iter_next (model, &iter);
g_free (indented_name);
}
gint accum_offset = 0;
gint i;
+ g_return_val_if_fail (group != NULL, -1);
+
for (i = 0; i < group->len && i < offset; i++) {
Node *node = &g_array_index (group, Node, i);
}
}
+ g_return_if_fail (group != NULL);
+
index = child_offset_to_generated_offset (group, index);
ITER_SET (tree_model_generator, generator_iter, group, index);
gtk_tree_path_free (path);
group = node->parent_group;
index = node->parent_index;
- generated_index = child_offset_to_generated_offset (group, index);
-
- if (group)
+ if (group) {
+ generated_index = child_offset_to_generated_offset (group, index);
gtk_tree_path_prepend_index (path, generated_index);
+ }
}
return path;
ITER_GET (iter, &group, &index);
index = generated_offset_to_child_offset (group, index, NULL);
- if (!index < 0)
+ if (index < 0)
return FALSE;
node = &g_array_index (group, Node, index);
if (!async_data->current_group) {
gpointer ad = async_data;
- foreach_configured_source_async_next (&ad, source);
- return ad;
+ if (foreach_configured_source_async_next (&ad, source))
+ return ad;
+
+ return NULL;
}
async_data->current_source = e_source_group_peek_sources (async_data->current_group->data);
{
EContact *contact;
EContactPhoto *photo;
- GError *error = NULL;
guchar *data;
gsize length = 0;
e_contact_set (contact, E_CONTACT_FULL_NAME, "Micheal Jackson");
if (!add_contact_verify (book, contact))
- g_error ("Failed to add contact: %s", error->message);
+ g_error ("Failed to add contact");
micheal_jackson_uid = e_contact_get (contact, E_CONTACT_UID);
}
{
EContact *contact;
EContactPhoto *photo;
- GError *error = NULL;
contact = e_contact_new ();
e_contact_set (contact, E_CONTACT_FULL_NAME, "James Brown");
if (!add_contact_verify (book, contact))
- g_error ("Failed to add contact: %s", error->message);
+ g_error ("Failed to add contact");
james_brown_uid = e_contact_get (contact, E_CONTACT_UID);
}
static void
add_contact (EBookClient *book_client)
{
- add_contact_from_test_case_verify (book_client, "name-only", NULL);
+ g_return_if_fail (add_contact_from_test_case_verify (book_client, "name-only", NULL));
}
static gboolean
test_print ("successfully asynchronously added the contact "
"addressbook\n");
- if (closure) {
+ if (closure->cb)
(*closure->cb) (closure);
- g_free (closure);
- }
+
+ g_free (closure);
}
void
test_print ("successfully asynchronously committed the contact to the "
"addressbook\n");
- if (closure) {
+ if (closure->cb)
(*closure->cb) (closure);
- g_free (closure);
- }
+
+ g_free (closure);
}
void
test_print ("successfully asynchronously retrieved the contact '%s'\n",
uid);
- if (closure) {
+ if (closure->cb)
(*closure->cb) (closure);
- g_free (closure);
- }
+
+ g_free (closure);
}
void
test_print ("successfully asynchronously retrieved the required fields\n");
- if (closure) {
+ if (closure->cb)
(*closure->cb) (closure);
- g_free (closure);
- }
+
+ g_free (closure);
}
void
test_print ("successfully asynchronously retrieved the supported auth "
"methods\n");
- if (closure) {
+ if (closure->cb)
(*closure->cb) (closure);
- g_free (closure);
- }
+ g_free (closure);
}
void
test_print ("successfully asynchronously retrieved the supported fields\n");
- if (closure) {
+ if (closure->cb)
(*closure->cb) (closure);
- g_free (closure);
- }
+ g_free (closure);
}
void
test_print ("successfully asynchronously removed the contact\n");
- if (closure) {
+ if (closure->cb)
(*closure->cb) (closure);
- g_free (closure);
- }
+
+ g_free (closure);
}
void
test_print ("successfully asynchronously removed the contact by id\n");
- if (closure) {
+ if (closure->cb)
(*closure->cb) (closure);
- g_free (closure);
- }
+
+ g_free (closure);
}
void
test_print ("successfully asynchronously removed the contacts\n");
- if (closure) {
+ if (closure->cb)
(*closure->cb) (closure);
- g_free (closure);
- }
+
+ g_free (closure);
}
void
test_print ("successfully asynchronously removed the temporary "
"addressbook\n");
- if (closure)
+ if (closure->cb)
(*closure->cb) (closure);
}
closure->view = view;
test_print ("successfully asynchronously retrieved the book view\n");
- if (closure)
+ if (closure->cb)
(*closure->cb) (closure);
}
e_contact_set (contact, E_CONTACT_CATEGORY_LIST, category_list);
- category_list = e_contact_get (contact, E_CONTACT_CATEGORY_LIST);
-
printf ("vcard = \n%s\n", e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30));
categories = e_contact_get (contact, E_CONTACT_CATEGORIES);
g_type_init_with_debug_flags (G_TYPE_DEBUG_OBJECTS);
fp = fopen (argv[1], "r");
+ if (fp == NULL) {
+ g_warning ("Faile to open vCard file '%s'", argv[1]);
+ return 1;
+ }
while (!feof (fp)) {
gchar buf[1024];
test_print ("successfully asynchronously removed the temporary "
"calendar\n");
- if (closure)
+ if (closure->cb)
(*closure->cb) (closure);
g_signal_handlers_disconnect_by_func (cal, open_ex_cb, closure);
closure->mode = mode;
test_print ("successfully set the calendar mode to %d\n", mode);
- if (closure)
+ if (closure->cb)
(*closure->cb) (closure);
g_signal_handlers_disconnect_by_func (cal, cal_set_mode_cb, closure);
{
va_list args;
- va_start (args, format);
- if ( client != client1)
+ if (client != client1)
return;
+
+ va_start (args, format);
printf ("Client %s: ", "Test");
vprintf (format, args);
va_end (args);
gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
book_client = e_book_client_new_default (NULL);
- e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, NULL);
+ g_warn_if_fail (e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, NULL));
e_contact_store_add_client (contact_store, book_client);
g_object_unref (book_client);