Message ID | 20250206164852.3649751-1-quic_amisjain@quicinc.com |
---|---|
State | Superseded |
Headers | show |
Series | [v2] obex: Add messages_get_message() implementation for MAP plugin | expand |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=931275 ---Test result--- Test Summary: CheckPatch PENDING 0.21 seconds GitLint PENDING 0.25 seconds BuildEll PASS 20.81 seconds BluezMake PASS 1598.52 seconds MakeCheck PASS 13.92 seconds MakeDistcheck PASS 161.51 seconds CheckValgrind PASS 217.20 seconds CheckSmatch PASS 288.93 seconds bluezmakeextell PASS 99.55 seconds IncrementalBuild PENDING 0.38 seconds ScanBuild PASS 885.93 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: --- Regards, Linux Bluetooth
diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c index 10b972d65..f63fcf6c6 100644 --- a/obexd/plugins/mas.c +++ b/obexd/plugins/mas.c @@ -612,11 +612,11 @@ static void *message_open(const char *name, int oflag, mode_t mode, return NULL; } + mas->buffer = g_string_new(""); + *err = messages_get_message(mas->backend_data, name, 0, get_message_cb, mas); - mas->buffer = g_string_new(""); - if (*err < 0) return NULL; else diff --git a/obexd/plugins/messages-dummy.c b/obexd/plugins/messages-dummy.c index e313c6163..93648831a 100644 --- a/obexd/plugins/messages-dummy.c +++ b/obexd/plugins/messages-dummy.c @@ -516,7 +516,37 @@ int messages_get_message(void *session, const char *handle, messages_get_message_cb callback, void *user_data) { - return -ENOSYS; + struct session *s = session; + FILE *fp; + char *path; + char buffer[1024]; + + DBG(" "); + path = g_build_filename(s->cwd_absolute, handle, NULL); + fp = fopen(path, "r"); + if (fp == NULL) + { + DBG("fopen() failed"); + return -EBADR; + } + + /* 1024 is the maximum size of the line which is calculated to be more + * sufficient*/ + while (fgets(buffer, 1024, fp)) { + if (callback) + { + callback(session, 0, 0, (const char*)buffer, user_data); + } + } + + if (callback) + { + callback(session, 0, 0, NULL, user_data); + } + + g_free(path); + fclose(fp); + return 0; } int messages_update_inbox(void *session, messages_status_cb callback,