summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/messageparser.cc42
-rw-r--r--src/messageparser.h5
2 files changed, 33 insertions, 14 deletions
diff --git a/src/messageparser.cc b/src/messageparser.cc
index e6d5e46..3b19b86 100644
--- a/src/messageparser.cc
+++ b/src/messageparser.cc
@@ -111,7 +111,7 @@ inline static void create_msg_list(MsgTokensList& msgTokensList,
if(t[0] == "observe") m.cmd = cmd::observe;
else if(t[0] == "unobserve") m.cmd = cmd::unobserve;
else if(t[0] == "add") m.cmd = cmd::add;
- else if(t[0] == "del") m.cmd = cmd::del;
+// else if(t[0] == "del") m.cmd = cmd::del;
else if(t[0] == "move") m.cmd = cmd::move;
else if(t[0] == "update") m.cmd = cmd::update;
else m.cmd = cmd::error;
@@ -146,14 +146,14 @@ inline static void create_msg_list(MsgTokensList& msgTokensList,
printf("addcmd: %s %s %d\n", m.add.title, m.add.desc, m.add.parentid);
break;
}
- case cmd::del: {
- if(t.size() != 1+1) {
- printf("Wrong number of parameters\n");
- continue;
- }
- m.del.id = atoi(t[1].c_str());
- break;
- }
+// case cmd::del: {
+// if(t.size() != 1+1) {
+// printf("Wrong number of parameters\n");
+// continue;
+// }
+// m.del.id = atoi(t[1].c_str());
+// break;
+// }
case cmd::move: {
if(t.size() != 2+1) {
printf("Wrong number of parameters\n");
@@ -202,10 +202,10 @@ std::string msg_tostring(message_t m) {
m.add.parentid);
break;
}
- case cmd::del: {
- asprintf(&buf, "del %d;", m.del.id);
- break;
- }
+// case cmd::del: {
+// asprintf(&buf, "del %d;", m.del.id);
+// break;
+// }
case cmd::move: {
asprintf(&buf, "move %d %d;", m.move.id, m.move.parentid);
break;
@@ -228,6 +228,22 @@ std::string msg_tostring(message_t m) {
return r;
}
+message_t create_msg_create(task_t t) {
+ message_t m;
+ m.cmd = cmd::add;
+ m.add.id = t.id;
+ return m;
+}
+
+message_t create_msg_update(task_t t) {
+ message_t m;
+ m.cmd = cmd::update;
+ m.update.id = t.id;
+ sprintf(m.add.title, "%s", t.title.c_str());
+ return m;
+}
+
+
#ifdef TEST_MSGPARSER
//Additional dependency files
//deps:
diff --git a/src/messageparser.h b/src/messageparser.h
index 6483794..c768579 100644
--- a/src/messageparser.h
+++ b/src/messageparser.h
@@ -32,7 +32,10 @@
MessageList parse_msg(std::string msg);
-message_t create_msg(cmd::cmd_t type, task_t task);
+//message_t create_msg(cmd::cmd_t type, task_t task);
std::string msg_tostring(message_t msg);
+message_t create_msg_create(taskid_t task);
+message_t create_msg_update(taskid_t task);
+
#endif/*__MUNIA_MESSAGEPARSER_H__*/