aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/pas
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-06-11 17:21:43 +0800
committerChris Lahey <clahey@src.gnome.org>2001-06-11 17:21:43 +0800
commit538e971cd862655c725b5b5ba5d020efcd949eef (patch)
tree72a9aaa09acc7a211a69f43f82e2932c5aff2263 /addressbook/backend/pas
parent84c05c9fd51f1f40ec6b3f624e339ecf31be6a07 (diff)
downloadgsoc2013-evolution-538e971cd862655c725b5b5ba5d020efcd949eef.tar
gsoc2013-evolution-538e971cd862655c725b5b5ba5d020efcd949eef.tar.gz
gsoc2013-evolution-538e971cd862655c725b5b5ba5d020efcd949eef.tar.bz2
gsoc2013-evolution-538e971cd862655c725b5b5ba5d020efcd949eef.tar.lz
gsoc2013-evolution-538e971cd862655c725b5b5ba5d020efcd949eef.tar.xz
gsoc2013-evolution-538e971cd862655c725b5b5ba5d020efcd949eef.tar.zst
gsoc2013-evolution-538e971cd862655c725b5b5ba5d020efcd949eef.zip
Made this handle the "id" property in searches.
2001-06-11 Christopher James Lahey <clahey@ximian.com> * backend/pas/pas-backend-file.c (entry_compare): Made this handle the "id" property in searches. (pas_backend_file_process_modify_card): Made id variable const here. * backend/pas/pas-backend-ldap.c (modify_card_handler): Made id variable const here. svn path=/trunk/; revision=10182
Diffstat (limited to 'addressbook/backend/pas')
-rw-r--r--addressbook/backend/pas/pas-backend-file.c22
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c2
2 files changed, 20 insertions, 4 deletions
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 222f72b74b..379c2433c8 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -275,12 +275,14 @@ static struct prop_info {
#define PROP_TYPE_NORMAL 0x01
#define PROP_TYPE_LIST 0x02
#define PROP_TYPE_LISTITEM 0x03
+#define PROP_TYPE_ID 0x04
int prop_type;
gboolean (*list_compare)(ECardSimple *ecard, const char *str,
char *(*compare)(const char*, const char*));
} prop_info_table[] = {
#define NORMAL_PROP(f,q,e) {f, q, e, PROP_TYPE_NORMAL, NULL}
+#define ID_PROP {0, "id", NULL, PROP_TYPE_ID, NULL}
#define LIST_PROP(q,e,c) {0, q, e, PROP_TYPE_LIST, c}
/* query prop, ecard prop, type, list compare function */
@@ -298,6 +300,7 @@ static struct prop_info {
NORMAL_PROP ( E_CARD_SIMPLE_FIELD_NICKNAME, "nickname", "nickname"),
NORMAL_PROP ( E_CARD_SIMPLE_FIELD_SPOUSE, "spouse", "spouse" ),
NORMAL_PROP ( E_CARD_SIMPLE_FIELD_NOTE, "note", "note"),
+ ID_PROP,
LIST_PROP ( "email", "email", compare_email ),
LIST_PROP ( "phone", "phone", compare_phone ),
LIST_PROP ( "address", "address", compare_address ),
@@ -341,10 +344,23 @@ entry_compare(PASBackendFileSearchContext *ctx, struct _ESExp *f,
if ((!prop) && compare("", argv[1]->value.string)) {
truth = TRUE;
}
- }
- else if (info->prop_type == PROP_TYPE_LIST) {
+ g_free (prop);
+ } else if (info->prop_type == PROP_TYPE_LIST) {
/* the special searches that match any of the list elements */
truth = info->list_compare (ctx->card, argv[1]->value.string, compare);
+ } else if (info->prop_type == PROP_TYPE_ID) {
+ const char *prop = NULL;
+ /* searches where the query's property
+ maps directly to an ecard property */
+
+ prop = e_card_get_id (ctx->card->card);
+
+ if (prop && compare(prop, argv[1]->value.string)) {
+ truth = TRUE;
+ }
+ if ((!prop) && compare("", argv[1]->value.string)) {
+ truth = TRUE;
+ }
}
/* if we're looking at all fields and find a match,
@@ -862,7 +878,7 @@ pas_backend_file_process_modify_card (PASBackend *backend,
int db_error;
EIterator *iterator;
ECard *card;
- char *id;
+ const char *id;
char *old_vcard_string;
/* create a new ecard from the request data */
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index fcb46bcae8..4acfaef225 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -1005,7 +1005,7 @@ modify_card_handler (PASBackend *backend, LDAPOp *op)
LDAPModifyOp *modify_op = (LDAPModifyOp*)op;
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
ECard *new_ecard;
- char *id;
+ const char *id;
int response;
int ldap_error = LDAP_SUCCESS;
GPtrArray *mod_array;