summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-11-04 10:24:23 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-11-04 10:25:42 -0500
commit473cd4a7c6277563dc2b582046f9b79a52c27ba1 (patch)
treef4eb32ecfe2295a1dd9d4f895079987571a2fe41 /plugins
parenta44bff189cee052b1f87fc43ee1d685073505115 (diff)
downloadofono-473cd4a7c6277563dc2b582046f9b79a52c27ba1.tar.bz2
smart-messaging: Implement SendAppointment
Diffstat (limited to 'plugins')
-rw-r--r--plugins/smart-messaging.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/plugins/smart-messaging.c b/plugins/smart-messaging.c
index 314eb226..e9437969 100644
--- a/plugins/smart-messaging.c
+++ b/plugins/smart-messaging.c
@@ -227,7 +227,44 @@ static DBusMessage *smart_messaging_send_vcard(DBusConnection *conn,
static DBusMessage *smart_messaging_send_vcal(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- return __ofono_error_not_implemented(msg);
+ struct smart_messaging *sm = data;
+ const char *to;
+ unsigned char *bytes;
+ int len;
+ GSList *msg_list;
+ unsigned int flags;
+ gboolean use_16bit_ref = FALSE;
+ int err;
+ struct ofono_uuid uuid;
+ unsigned short ref;
+
+ if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &to,
+ DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
+ &bytes, &len, DBUS_TYPE_INVALID))
+ return __ofono_error_invalid_args(msg);
+
+ if (valid_phone_number_format(to) == FALSE)
+ return __ofono_error_invalid_format(msg);
+
+ ref = __ofono_sms_get_next_ref(sm->sms);
+ msg_list = sms_datagram_prepare(to, bytes, len, ref, use_16bit_ref,
+ 0, VCAL_DST_PORT, TRUE, FALSE);
+
+ if (!msg_list)
+ return __ofono_error_invalid_format(msg);
+
+ flags = OFONO_SMS_SUBMIT_FLAG_RETRY | OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS;
+
+ err = __ofono_sms_txq_submit(sm->sms, msg_list, flags, &uuid,
+ message_queued, msg);
+
+ g_slist_foreach(msg_list, (GFunc)g_free, NULL);
+ g_slist_free(msg_list);
+
+ if (err < 0)
+ return __ofono_error_failed(msg);
+
+ return NULL;
}
static GDBusMethodTable smart_messaging_methods[] = {