Commit 557e2d4e authored by Chris T's avatar Chris T

Fix git commit mess up

parent 081ed3d1
......@@ -120,12 +120,14 @@ struct mms_retrieve_conf {
char *priority;
char *msgid;
time_t date;
char *datestamp;
};
struct mms_send_req {
enum mms_message_status status;
char *to;
time_t date;
char *datestamp;
char *content_type;
gboolean dr;
};
......
......@@ -692,7 +692,8 @@ static gboolean result_request_send_conf(struct mms_request *request)
g_key_file_set_string(meta, "info", "state", "sent");
g_key_file_set_string(meta, "info", "id", msg->sc.msgid);
msg->sr.status = MMS_MESSAGE_STATUS_SENT;
//TODO: You need to change the status of the dbus!
mms_message_free(msg);
mms_store_meta_close(service->identity, uuid, meta, TRUE);
......@@ -1018,6 +1019,7 @@ static DBusMessage *send_message(DBusConnection *conn,
struct mms_service *service = data;
struct mms_request *request;
GKeyFile *meta;
const char *datestr;
msg = g_new0(struct mms_message, 1);
if (msg == NULL)
......@@ -1032,6 +1034,10 @@ static DBusMessage *send_message(DBusConnection *conn,
time(&msg->sr.date);
datestr = time_to_str(&msg->sr.date);
msg->sr.datestamp = g_strdup(datestr);
if (send_message_get_args(dbus_msg, msg) == FALSE) {
mms_debug("Invalid arguments");
......@@ -1072,6 +1078,7 @@ static DBusMessage *send_message(DBusConnection *conn,
if (meta == NULL)
goto release_request;
g_key_file_set_string(meta, "info", "date", msg->sr.datestamp);
g_key_file_set_string(meta, "info", "state", "draft");
if (service->use_delivery_reports) {
......@@ -1312,10 +1319,12 @@ static gboolean load_message_from_store(const char *service_id,
char *state = NULL;
gboolean read_status;
char *data_path = NULL;
char *datestr = NULL;
gboolean success = FALSE;
gboolean tainted = FALSE;
void *pdu;
size_t len;
struct tm tm;
meta = mms_store_meta_open(service_id, uuid);
if (meta == NULL)
......@@ -1327,6 +1336,10 @@ static gboolean load_message_from_store(const char *service_id,
read_status = g_key_file_get_boolean(meta, "info", "read", NULL);
datestr = g_key_file_get_string(meta, "info", "date", NULL);
//strptime(datestr, "%Y-%m-%dT%H:%M:%S%z", &tm);
//TODO: Need to fix this and reimport tm to time_t
data_path = mms_store_get_path(service_id, uuid);
if (data_path == NULL)
goto out;
......@@ -1345,25 +1358,26 @@ static gboolean load_message_from_store(const char *service_id,
msg->uuid = g_strdup(uuid);
if (strcmp(state, "received") == 0
&& msg->type == MMS_MESSAGE_TYPE_RETRIEVE_CONF) {
if (strcmp(state, "received") == 0 && msg->type == MMS_MESSAGE_TYPE_RETRIEVE_CONF) {
if (read_status == TRUE)
msg->rc.status = MMS_MESSAGE_STATUS_READ;
else
msg->rc.status = MMS_MESSAGE_STATUS_RECEIVED;
} else if (strcmp(state, "downloaded") == 0
&& msg->type == MMS_MESSAGE_TYPE_RETRIEVE_CONF) {
} else if (strcmp(state, "downloaded") == 0 && msg->type == MMS_MESSAGE_TYPE_RETRIEVE_CONF) {
msg->rc.status = MMS_MESSAGE_STATUS_DOWNLOADED;
if (msg->transaction_id == NULL)
msg->transaction_id = "";
} else if (strcmp(state, "sent") == 0
&& msg->type == MMS_MESSAGE_TYPE_SEND_REQ)
} else if (strcmp(state, "sent") == 0 && msg->type == MMS_MESSAGE_TYPE_SEND_REQ) {
msg->sr.datestamp = g_strdup(datestr);
msg->sr.date = mktime(&tm);
msg->sr.status = MMS_MESSAGE_STATUS_SENT;
else if (strcmp(state, "draft") == 0
&& msg->type == MMS_MESSAGE_TYPE_SEND_REQ)
}
else if (strcmp(state, "draft") == 0 && msg->type == MMS_MESSAGE_TYPE_SEND_REQ) {
msg->sr.datestamp = g_strdup(datestr);
msg->sr.date = mktime(&tm);
msg->sr.status = MMS_MESSAGE_STATUS_DRAFT;
else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND &&
msg->type != MMS_MESSAGE_TYPE_DELIVERY_IND)
}
else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND && msg->type != MMS_MESSAGE_TYPE_DELIVERY_IND)
goto out;
success = TRUE;
......@@ -1616,7 +1630,7 @@ int mms_service_unregister(struct mms_service *service)
return 0;
}
static const char *time_to_str(const time_t *t)
const char *time_to_str(const time_t *t)
{
static char buf[128];
struct tm tm;
......@@ -1852,14 +1866,13 @@ static void append_rc_msg_properties(DBusMessageIter *dict,
static void append_sr_msg_properties(DBusMessageIter *dict,
struct mms_message *msg)
{
const char *date = time_to_str(&msg->sr.date);
const char *status = mms_message_status_get_string(msg->sr.status);
mms_dbus_dict_append_basic(dict, "Status",
DBUS_TYPE_STRING, &status);
mms_dbus_dict_append_basic(dict, "Date",
DBUS_TYPE_STRING, &date);
DBUS_TYPE_STRING, &msg->sr.datestamp);
if (msg->sr.to != NULL)
append_msg_recipients(dict, msg);
......@@ -2633,4 +2646,4 @@ void __mms_service_cleanup(void)
if (g_dbus_unregister_interface(connection, MMS_PATH,
MMS_MANAGER_INTERFACE) == FALSE)
mms_error("Failed to unregister manager interface");
}
\ No newline at end of file
}
......@@ -52,3 +52,7 @@ int mms_message_register(struct mms_service *service,
struct mms_message *msg);
int mms_message_unregister(const struct mms_service *service,
const char *msg_path);
const char *time_to_str(const time_t *t);
void debug_print(const char* s, void* data);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment