* [PATCH obexd 1/2] Add tracker backend stump for MAP @ 2011-07-14 13:46 Bartosz Szatkowski 2011-07-14 13:46 ` [PATCH obexd 2/2] Add SetFolder function for MAP tracker backend Bartosz Szatkowski 2011-07-14 13:59 ` [PATCH obexd 1/2] Add tracker backend stump for MAP Johan Hedberg 0 siblings, 2 replies; 10+ messages in thread From: Bartosz Szatkowski @ 2011-07-14 13:46 UTC (permalink / raw) To: linux-bluetooth; +Cc: Bartosz Szatkowski --- plugins/messages-tracker.c | 98 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+), 0 deletions(-) create mode 100644 plugins/messages-tracker.c diff --git a/plugins/messages-tracker.c b/plugins/messages-tracker.c new file mode 100644 index 0000000..88e7493 --- /dev/null +++ b/plugins/messages-tracker.c @@ -0,0 +1,98 @@ +/* + * + * OBEX Server + * + * Copyright (C) 2010-2011 Nokia Corporation + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <errno.h> + +#include "messages.h" + +int messages_init(void) +{ + return 0; +} + +void messages_exit(void) +{ +} + +int messages_connect(void **s) +{ + *s = NULL; + + return 0; +} + +void messages_disconnect(void *s) +{ +} + +int messages_set_notification_registration(void *session, + void (*send_event)(void *session, + struct messages_event *event, void *user_data), + void *user_data) +{ + return -EINVAL; +} + +int messages_set_folder(void *s, const char *name, gboolean cdup) +{ + return -EINVAL; +} + +int messages_get_folder_listing(void *session, + const char *name, + uint16_t max, uint16_t offset, + void (*callback)(void *session, int err, uint16_t size, + const char *name, void *user_data), + void *user_data) +{ + return -EINVAL; +} + +int messages_get_messages_listing(void *session, + const char *name, + uint16_t max, uint16_t offset, struct messages_filter *filter, + void (*callback)(void *session, int err, uint16_t size, + gboolean newmsg, const struct messages_message *message, + void *user_data), + void *user_data) +{ + return -EINVAL; +} + +int messages_get_message(void *session, + const char *handle, + unsigned long flags, + void (*callback)(void *session, int err, gboolean fmore, + const char *chunk, void *user_data), + void *user_data) +{ + return -EINVAL; +} + +void messages_abort(void *session) +{ +} -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH obexd 2/2] Add SetFolder function for MAP tracker backend 2011-07-14 13:46 [PATCH obexd 1/2] Add tracker backend stump for MAP Bartosz Szatkowski @ 2011-07-14 13:46 ` Bartosz Szatkowski 2011-07-14 14:08 ` Johan Hedberg 2011-07-14 13:59 ` [PATCH obexd 1/2] Add tracker backend stump for MAP Johan Hedberg 1 sibling, 1 reply; 10+ messages in thread From: Bartosz Szatkowski @ 2011-07-14 13:46 UTC (permalink / raw) To: linux-bluetooth; +Cc: Bartosz Szatkowski --- plugins/messages-tracker.c | 175 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 173 insertions(+), 2 deletions(-) diff --git a/plugins/messages-tracker.c b/plugins/messages-tracker.c index 88e7493..63d7fc6 100644 --- a/plugins/messages-tracker.c +++ b/plugins/messages-tracker.c @@ -26,27 +26,157 @@ #endif #include <errno.h> +#include <glib.h> +#include <string.h> #include "messages.h" +struct message_folder { + char *name; + GSList *subfolders; + char *query; +}; + +struct session { + char *cwd; + struct message_folder *folder; +}; + +static char *root_folder = "/"; +static struct message_folder *folder_tree = NULL; + +static struct message_folder *get_folder(const char *folder) +{ + GSList *current = folder_tree->subfolders; + GSList *last; + int i = 1; + char **path; + + if (g_strcmp0(folder, "/") == 0) + return folder_tree; + + path = g_strsplit(folder, "/", 0); + + while (path[i] != NULL) { + GSList *next = current; + int find = 0; + + while (next != NULL) { + struct message_folder *next_data = next->data; + + if (g_strcmp0(next_data->name, path[i]) == 0) { + find = 1; + last = next; + current = next_data->subfolders; + + break; + } + + next = g_slist_next(next); + } + + if (find == 0) { + g_strfreev(path); + return NULL; + } + + i++; + } + + g_strfreev(path); + return last->data; +} + +static struct message_folder *create_folder(const char *name, const char *query) +{ + struct message_folder *folder = g_new0(struct message_folder, 1); + + folder->name = g_strdup(name); + folder->query = g_strdup(query); + + return folder; +} + +static void destroy_folder_tree(void *root) +{ + struct message_folder *folder = root; + GSList *tmp, *next; + + if (folder == NULL) + return; + + g_free(folder->name); + g_free(folder->query); + + tmp = folder->subfolders; + while (tmp != NULL) { + next = g_slist_next(tmp); + destroy_folder_tree(tmp->data); + tmp = next; + } + + g_slist_free(folder->subfolders); + g_free(folder); +} + +static void create_folder_tree() +{ + struct message_folder *parent, *child; + + folder_tree = create_folder("/", NULL); + + parent = create_folder("telecom", NULL); + folder_tree->subfolders = g_slist_append(folder_tree->subfolders, + parent); + + child = create_folder("msg", NULL); + parent->subfolders = g_slist_append(parent->subfolders, child); + + parent = child; + + child = create_folder("inbox", "?msg nmo:isSent \"false\" ; " + "nmo:isDeleted \"false\" ; " + "nmo:isDraft \"false\". "); + parent->subfolders = g_slist_append(parent->subfolders, child); + + child = create_folder("sent", "?msg nmo:isDeleted \"false\" ; " + "nmo:isSent \"true\" . "); + parent->subfolders = g_slist_append(parent->subfolders, child); + + child = create_folder("deleted", "?msg nmo:isDeleted \"true\" . "); + parent->subfolders = g_slist_append(parent->subfolders, child); +} + int messages_init(void) { + create_folder_tree(); + return 0; } void messages_exit(void) { + destroy_folder_tree(folder_tree); } int messages_connect(void **s) { - *s = NULL; + struct session *session = g_new0(struct session, 1); + + session->cwd = g_strdup(root_folder); + session->folder = folder_tree; + + *s = session; return 0; } void messages_disconnect(void *s) { + struct session *session = s; + + g_free(session->cwd); + g_free(session); } int messages_set_notification_registration(void *session, @@ -59,7 +189,48 @@ int messages_set_notification_registration(void *session, int messages_set_folder(void *s, const char *name, gboolean cdup) { - return -EINVAL; + struct session *session = s; + char *newrel = NULL; + char *newabs; + char *tmp; + + if (name && (strchr(name, '/') || strcmp(name, "..") == 0)) + return -EBADR; + + if (cdup) { + if (session->cwd[0] == 0) + return -ENOENT; + + newrel = g_path_get_dirname(session->cwd); + + /* We use empty string for indication of the root directory */ + if (newrel[0] == '.' && newrel[1] == 0) + newrel[0] = 0; + } + + tmp = newrel; + if (!cdup && (!name || name[0] == 0)) + newrel = g_strdup(""); + else + newrel = g_build_filename(newrel ? newrel : session->cwd, name, + NULL); + g_free(tmp); + + newabs = g_build_filename(root_folder, newrel, NULL); + + session->folder = get_folder(newabs); + if (session->folder == NULL) { + g_free(newrel); + g_free(newabs); + + return -ENOENT; + } + + g_free(newrel); + g_free(session->cwd); + session->cwd = newabs; + + return 0; } int messages_get_folder_listing(void *session, -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH obexd 2/2] Add SetFolder function for MAP tracker backend 2011-07-14 13:46 ` [PATCH obexd 2/2] Add SetFolder function for MAP tracker backend Bartosz Szatkowski @ 2011-07-14 14:08 ` Johan Hedberg 2011-07-15 12:29 ` [PATCH obexd 2/2 v2] " Bartosz Szatkowski 0 siblings, 1 reply; 10+ messages in thread From: Johan Hedberg @ 2011-07-14 14:08 UTC (permalink / raw) To: Bartosz Szatkowski; +Cc: linux-bluetooth Hi Bartosz, On Thu, Jul 14, 2011, Bartosz Szatkowski wrote: > +static char *root_folder = "/"; Do you intend to change this a runtime in the future? If not, I don't think you need a special varialble for it. > +static struct message_folder *get_folder(const char *folder) > +{ > + GSList *current = folder_tree->subfolders; > + GSList *last; > + int i = 1; > + char **path; > + > + if (g_strcmp0(folder, "/") == 0) > + return folder_tree; > + > + path = g_strsplit(folder, "/", 0); > + > + while (path[i] != NULL) { This should be a for-loop: for (i = 1; path[i] != NULL; i++) > + GSList *next = current; You seem to use this as a simple iterator, so please call it simply l instead of next; > + int find = 0; This is used as a boolean so please use gboolean instead of an int. I also think that match_found would be a better name. > + while (next != NULL) { This should be a for-loop too: for (l = current; l != NULL; l = g_slist_next(l)) > +static void create_folder_tree() > +{ > + struct message_folder *parent, *child; > + > + folder_tree = create_folder("/", NULL); > + > + parent = create_folder("telecom", NULL); > + folder_tree->subfolders = g_slist_append(folder_tree->subfolders, > + parent); Mixed tabs and spaces for indentation in the last line above. Johan ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH obexd 2/2 v2] Add SetFolder function for MAP tracker backend 2011-07-14 14:08 ` Johan Hedberg @ 2011-07-15 12:29 ` Bartosz Szatkowski 2011-07-26 9:24 ` Johan Hedberg 0 siblings, 1 reply; 10+ messages in thread From: Bartosz Szatkowski @ 2011-07-15 12:29 UTC (permalink / raw) To: linux-bluetooth; +Cc: Bartosz Szatkowski --- plugins/messages-tracker.c | 170 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 168 insertions(+), 2 deletions(-) diff --git a/plugins/messages-tracker.c b/plugins/messages-tracker.c index 88e7493..de16337 100644 --- a/plugins/messages-tracker.c +++ b/plugins/messages-tracker.c @@ -26,27 +26,152 @@ #endif #include <errno.h> +#include <glib.h> +#include <string.h> #include "messages.h" +struct message_folder { + char *name; + GSList *subfolders; + char *query; +}; + +struct session { + char *cwd; + struct message_folder *folder; +}; + +static struct message_folder *folder_tree = NULL; + +static struct message_folder *get_folder(const char *folder) +{ + GSList *current = folder_tree->subfolders; + GSList *last; + int i; + char **path; + + if (g_strcmp0(folder, "/") == 0) + return folder_tree; + + path = g_strsplit(folder, "/", 0); + + for (i = 1; path[i] != NULL; i++) { + GSList *l = current; + gboolean match_find = FALSE; + + for (l = current; l != NULL; l = g_slist_next(l)) { + struct message_folder *l_data = l->data; + + if (g_strcmp0(l_data->name, path[i]) == 0) { + match_find = TRUE; + last = l; + current = l_data->subfolders; + + break; + } + } + + if (!match_find) { + g_strfreev(path); + return NULL; + } + } + + g_strfreev(path); + return last->data; +} + +static struct message_folder *create_folder(const char *name, const char *query) +{ + struct message_folder *folder = g_new0(struct message_folder, 1); + + folder->name = g_strdup(name); + folder->query = g_strdup(query); + + return folder; +} + +static void destroy_folder_tree(void *root) +{ + struct message_folder *folder = root; + GSList *tmp, *next; + + if (folder == NULL) + return; + + g_free(folder->name); + g_free(folder->query); + + tmp = folder->subfolders; + while (tmp != NULL) { + next = g_slist_next(tmp); + destroy_folder_tree(tmp->data); + tmp = next; + } + + g_slist_free(folder->subfolders); + g_free(folder); +} + +static void create_folder_tree() +{ + struct message_folder *parent, *child; + + folder_tree = create_folder("/", NULL); + + parent = create_folder("telecom", NULL); + folder_tree->subfolders = g_slist_append(folder_tree->subfolders, + parent); + + child = create_folder("msg", NULL); + parent->subfolders = g_slist_append(parent->subfolders, child); + + parent = child; + + child = create_folder("inbox", "?msg nmo:isSent \"false\" ; " + "nmo:isDeleted \"false\" ; " + "nmo:isDraft \"false\". "); + parent->subfolders = g_slist_append(parent->subfolders, child); + + child = create_folder("sent", "?msg nmo:isDeleted \"false\" ; " + "nmo:isSent \"true\" . "); + parent->subfolders = g_slist_append(parent->subfolders, child); + + child = create_folder("deleted", "?msg nmo:isDeleted \"true\" . "); + parent->subfolders = g_slist_append(parent->subfolders, child); +} + int messages_init(void) { + create_folder_tree(); + return 0; } void messages_exit(void) { + destroy_folder_tree(folder_tree); } int messages_connect(void **s) { - *s = NULL; + struct session *session = g_new0(struct session, 1); + + session->cwd = g_strdup("/"); + session->folder = folder_tree; + + *s = session; return 0; } void messages_disconnect(void *s) { + struct session *session = s; + + g_free(session->cwd); + g_free(session); } int messages_set_notification_registration(void *session, @@ -59,7 +184,48 @@ int messages_set_notification_registration(void *session, int messages_set_folder(void *s, const char *name, gboolean cdup) { - return -EINVAL; + struct session *session = s; + char *newrel = NULL; + char *newabs; + char *tmp; + + if (name && (strchr(name, '/') || strcmp(name, "..") == 0)) + return -EBADR; + + if (cdup) { + if (session->cwd[0] == 0) + return -ENOENT; + + newrel = g_path_get_dirname(session->cwd); + + /* We use empty string for indication of the root directory */ + if (newrel[0] == '.' && newrel[1] == 0) + newrel[0] = 0; + } + + tmp = newrel; + if (!cdup && (!name || name[0] == 0)) + newrel = g_strdup(""); + else + newrel = g_build_filename(newrel ? newrel : session->cwd, name, + NULL); + g_free(tmp); + + newabs = g_build_filename("/", newrel, NULL); + + session->folder = get_folder(newabs); + if (session->folder == NULL) { + g_free(newrel); + g_free(newabs); + + return -ENOENT; + } + + g_free(newrel); + g_free(session->cwd); + session->cwd = newabs; + + return 0; } int messages_get_folder_listing(void *session, -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH obexd 2/2 v2] Add SetFolder function for MAP tracker backend 2011-07-15 12:29 ` [PATCH obexd 2/2 v2] " Bartosz Szatkowski @ 2011-07-26 9:24 ` Johan Hedberg 2011-07-26 9:40 ` [PATCH] " Bartosz Szatkowski 0 siblings, 1 reply; 10+ messages in thread From: Johan Hedberg @ 2011-07-26 9:24 UTC (permalink / raw) To: Bartosz Szatkowski; +Cc: linux-bluetooth Hi Bartosz, On Fri, Jul 15, 2011, Bartosz Szatkowski wrote: > --- > plugins/messages-tracker.c | 170 +++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 168 insertions(+), 2 deletions(-) This doesn't compile: plugins/messages.c: In function ‘messages_set_folder’: plugins/messages.c:82:2: error: ‘last’ may be used uninitialized in this function [-Werror=uninitialized] plugins/messages.c:50:10: note: ‘last’ was declared here Additionally, please use match_found and not match_find as a variable name. Johan ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] Add SetFolder function for MAP tracker backend 2011-07-26 9:24 ` Johan Hedberg @ 2011-07-26 9:40 ` Bartosz Szatkowski 2011-07-26 10:32 ` Johan Hedberg 0 siblings, 1 reply; 10+ messages in thread From: Bartosz Szatkowski @ 2011-07-26 9:40 UTC (permalink / raw) To: linux-bluetooth; +Cc: Bartosz Szatkowski --- plugins/messages-tracker.c | 236 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 232 insertions(+), 4 deletions(-) diff --git a/plugins/messages-tracker.c b/plugins/messages-tracker.c index 88e7493..4ae90dc 100644 --- a/plugins/messages-tracker.c +++ b/plugins/messages-tracker.c @@ -26,27 +26,158 @@ #endif #include <errno.h> +#include <glib.h> +#include <string.h> #include "messages.h" +struct message_folder { + char *name; + GSList *subfolders; + char *query; +}; + +struct session { + char *cwd; + struct message_folder *folder; + const char *name; + uint16_t max; + uint16_t offset; + void *user_data; + void (*folder_list_cb)(void *session, int err, uint16_t size, + const char *name, void *user_data); +}; + +static struct message_folder *folder_tree = NULL; + +static struct message_folder *get_folder(const char *folder) +{ + GSList *current = folder_tree->subfolders; + struct message_folder *last = NULL; + int i; + char **path; + + if (g_strcmp0(folder, "/") == 0) + return folder_tree; + + path = g_strsplit(folder, "/", 0); + + for (i = 1; path[i] != NULL; i++) { + GSList *l = current; + gboolean match_found = FALSE; + + for (l = current; l != NULL; l = g_slist_next(l)) { + struct message_folder *l_data = l->data; + + if (g_strcmp0(l_data->name, path[i]) == 0) { + match_found = TRUE; + last = l->data; + current = l_data->subfolders; + + break; + } + } + + if (!match_found) { + g_strfreev(path); + return NULL; + } + } + + g_strfreev(path); + return last; +} + +static struct message_folder *create_folder(const char *name, const char *query) +{ + struct message_folder *folder = g_new0(struct message_folder, 1); + + folder->name = g_strdup(name); + folder->query = g_strdup(query); + + return folder; +} + +static void destroy_folder_tree(void *root) +{ + struct message_folder *folder = root; + GSList *tmp, *next; + + if (folder == NULL) + return; + + g_free(folder->name); + g_free(folder->query); + + tmp = folder->subfolders; + while (tmp != NULL) { + next = g_slist_next(tmp); + destroy_folder_tree(tmp->data); + tmp = next; + } + + g_slist_free(folder->subfolders); + g_free(folder); +} + +static void create_folder_tree() +{ + struct message_folder *parent, *child; + + folder_tree = create_folder("/", NULL); + + parent = create_folder("telecom", NULL); + folder_tree->subfolders = g_slist_append(folder_tree->subfolders, + parent); + + child = create_folder("msg", NULL); + parent->subfolders = g_slist_append(parent->subfolders, child); + + parent = child; + + child = create_folder("inbox", "?msg nmo:isSent \"false\" ; " + "nmo:isDeleted \"false\" ; " + "nmo:isDraft \"false\". "); + parent->subfolders = g_slist_append(parent->subfolders, child); + + child = create_folder("sent", "?msg nmo:isDeleted \"false\" ; " + "nmo:isSent \"true\" . "); + parent->subfolders = g_slist_append(parent->subfolders, child); + + child = create_folder("deleted", "?msg nmo:isDeleted \"true\" . "); + parent->subfolders = g_slist_append(parent->subfolders, child); +} + int messages_init(void) { + create_folder_tree(); + return 0; } void messages_exit(void) { + destroy_folder_tree(folder_tree); } int messages_connect(void **s) { - *s = NULL; + struct session *session = g_new0(struct session, 1); + + session->cwd = g_strdup("/"); + session->folder = folder_tree; + + *s = session; return 0; } void messages_disconnect(void *s) { + struct session *session = s; + + g_free(session->cwd); + g_free(session); } int messages_set_notification_registration(void *session, @@ -59,17 +190,114 @@ int messages_set_notification_registration(void *session, int messages_set_folder(void *s, const char *name, gboolean cdup) { - return -EINVAL; + struct session *session = s; + char *newrel = NULL; + char *newabs; + char *tmp; + + if (name && (strchr(name, '/') || strcmp(name, "..") == 0)) + return -EBADR; + + if (cdup) { + if (session->cwd[0] == 0) + return -ENOENT; + + newrel = g_path_get_dirname(session->cwd); + + /* We use empty string for indication of the root directory */ + if (newrel[0] == '.' && newrel[1] == 0) + newrel[0] = 0; + } + + tmp = newrel; + if (!cdup && (!name || name[0] == 0)) + newrel = g_strdup(""); + else + newrel = g_build_filename(newrel ? newrel : session->cwd, name, + NULL); + g_free(tmp); + + newabs = g_build_filename("/", newrel, NULL); + + session->folder = get_folder(newabs); + if (session->folder == NULL) { + g_free(newrel); + g_free(newabs); + + return -ENOENT; + } + + g_free(newrel); + g_free(session->cwd); + session->cwd = newabs; + + return 0; } -int messages_get_folder_listing(void *session, +static gboolean async_get_folder_listing(void *s) { + struct session *session = s; + gboolean count = FALSE; + int folder_count = 0; + char *path = NULL; + struct message_folder *folder; + GSList *dir; + + if (session->name && strchr(session->name, '/') != NULL) + goto done; + + path = g_build_filename(session->cwd, session->name, NULL); + + if (path == NULL || strlen(path) == 0) + goto done; + + folder = get_folder(path); + + if (folder == NULL) + goto done; + + if (session->max == 0) { + session->max = 0xffff; + session->offset = 0; + count = TRUE; + } + + for (dir = folder->subfolders; dir && + (folder_count - session->offset) < session->max; + folder_count++, dir = g_slist_next(dir)) { + struct message_folder *dir_data = dir->data; + + if (count == FALSE && session->offset < folder_count) + session->folder_list_cb(session, -EAGAIN, 0, + dir_data->name, session->user_data); + } + + done: + session->folder_list_cb(session, 0, folder_count, NULL, + session->user_data); + + g_free(path); + + return FALSE; +} + +int messages_get_folder_listing(void *s, const char *name, uint16_t max, uint16_t offset, void (*callback)(void *session, int err, uint16_t size, const char *name, void *user_data), void *user_data) { - return -EINVAL; + struct session *session = s; + session->name = name; + session->max = max; + session->offset = offset; + session->folder_list_cb = callback; + session->user_data = user_data; + + g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, async_get_folder_listing, + session, NULL); + + return 0; } int messages_get_messages_listing(void *session, -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] Add SetFolder function for MAP tracker backend 2011-07-26 9:40 ` [PATCH] " Bartosz Szatkowski @ 2011-07-26 10:32 ` Johan Hedberg 0 siblings, 0 replies; 10+ messages in thread From: Johan Hedberg @ 2011-07-26 10:32 UTC (permalink / raw) To: Bartosz Szatkowski; +Cc: linux-bluetooth Hi Bartosz, On Tue, Jul 26, 2011, Bartosz Szatkowski wrote: > --- > plugins/messages-tracker.c | 236 +++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 232 insertions(+), 4 deletions(-) Applied after I made a few more cosmetic fixes to the get_folder function. Thanks. Johan ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH obexd 1/2] Add tracker backend stump for MAP 2011-07-14 13:46 [PATCH obexd 1/2] Add tracker backend stump for MAP Bartosz Szatkowski 2011-07-14 13:46 ` [PATCH obexd 2/2] Add SetFolder function for MAP tracker backend Bartosz Szatkowski @ 2011-07-14 13:59 ` Johan Hedberg 2011-07-14 14:07 ` [PATCH obexd 1/2 v2] " Bartosz Szatkowski 1 sibling, 1 reply; 10+ messages in thread From: Johan Hedberg @ 2011-07-14 13:59 UTC (permalink / raw) To: Bartosz Szatkowski; +Cc: linux-bluetooth Hi Bartosz, On Thu, Jul 14, 2011, Bartosz Szatkowski wrote: > --- > plugins/messages-tracker.c | 98 ++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 98 insertions(+), 0 deletions(-) > create mode 100644 plugins/messages-tracker.c This patch should also add the new file to Makefile.am (EXTRA_DIST I suppose). Otherwise the file will be left out of the tarball when doing "make dist". Johan ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH obexd 1/2 v2] Add tracker backend stump for MAP 2011-07-14 13:59 ` [PATCH obexd 1/2] Add tracker backend stump for MAP Johan Hedberg @ 2011-07-14 14:07 ` Bartosz Szatkowski 2011-07-14 14:14 ` Johan Hedberg 0 siblings, 1 reply; 10+ messages in thread From: Bartosz Szatkowski @ 2011-07-14 14:07 UTC (permalink / raw) To: linux-bluetooth; +Cc: Bartosz Szatkowski --- Makefile.am | 2 +- plugins/messages-tracker.c | 98 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 1 deletions(-) create mode 100644 plugins/messages-tracker.c diff --git a/Makefile.am b/Makefile.am index 14ab6e9..12d0b9c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -143,7 +143,7 @@ EXTRA_DIST = src/genbuiltin $(doc_files) $(test_files) \ src/obexd.service.in client/obex-client.service.in \ plugins/phonebook-dummy.c plugins/phonebook-ebook.c \ plugins/phonebook-tracker.c \ - plugins/messages-dummy.c + plugins/messages-dummy.c plugins/messages-tracker.c DISTCHECK_CONFIGURE_FLAGS = --enable-client --enable-server diff --git a/plugins/messages-tracker.c b/plugins/messages-tracker.c new file mode 100644 index 0000000..88e7493 --- /dev/null +++ b/plugins/messages-tracker.c @@ -0,0 +1,98 @@ +/* + * + * OBEX Server + * + * Copyright (C) 2010-2011 Nokia Corporation + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <errno.h> + +#include "messages.h" + +int messages_init(void) +{ + return 0; +} + +void messages_exit(void) +{ +} + +int messages_connect(void **s) +{ + *s = NULL; + + return 0; +} + +void messages_disconnect(void *s) +{ +} + +int messages_set_notification_registration(void *session, + void (*send_event)(void *session, + struct messages_event *event, void *user_data), + void *user_data) +{ + return -EINVAL; +} + +int messages_set_folder(void *s, const char *name, gboolean cdup) +{ + return -EINVAL; +} + +int messages_get_folder_listing(void *session, + const char *name, + uint16_t max, uint16_t offset, + void (*callback)(void *session, int err, uint16_t size, + const char *name, void *user_data), + void *user_data) +{ + return -EINVAL; +} + +int messages_get_messages_listing(void *session, + const char *name, + uint16_t max, uint16_t offset, struct messages_filter *filter, + void (*callback)(void *session, int err, uint16_t size, + gboolean newmsg, const struct messages_message *message, + void *user_data), + void *user_data) +{ + return -EINVAL; +} + +int messages_get_message(void *session, + const char *handle, + unsigned long flags, + void (*callback)(void *session, int err, gboolean fmore, + const char *chunk, void *user_data), + void *user_data) +{ + return -EINVAL; +} + +void messages_abort(void *session) +{ +} -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH obexd 1/2 v2] Add tracker backend stump for MAP 2011-07-14 14:07 ` [PATCH obexd 1/2 v2] " Bartosz Szatkowski @ 2011-07-14 14:14 ` Johan Hedberg 0 siblings, 0 replies; 10+ messages in thread From: Johan Hedberg @ 2011-07-14 14:14 UTC (permalink / raw) To: Bartosz Szatkowski; +Cc: linux-bluetooth Hi Bartosz, On Thu, Jul 14, 2011, Bartosz Szatkowski wrote: > --- > Makefile.am | 2 +- > plugins/messages-tracker.c | 98 ++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 99 insertions(+), 1 deletions(-) > create mode 100644 plugins/messages-tracker.c This patch has been applied. Thanks. Johan ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-07-26 10:32 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-07-14 13:46 [PATCH obexd 1/2] Add tracker backend stump for MAP Bartosz Szatkowski 2011-07-14 13:46 ` [PATCH obexd 2/2] Add SetFolder function for MAP tracker backend Bartosz Szatkowski 2011-07-14 14:08 ` Johan Hedberg 2011-07-15 12:29 ` [PATCH obexd 2/2 v2] " Bartosz Szatkowski 2011-07-26 9:24 ` Johan Hedberg 2011-07-26 9:40 ` [PATCH] " Bartosz Szatkowski 2011-07-26 10:32 ` Johan Hedberg 2011-07-14 13:59 ` [PATCH obexd 1/2] Add tracker backend stump for MAP Johan Hedberg 2011-07-14 14:07 ` [PATCH obexd 1/2 v2] " Bartosz Szatkowski 2011-07-14 14:14 ` Johan Hedberg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).