summaryrefslogtreecommitdiff
path: root/src/munia_proto.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-05-04 14:08:58 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2012-05-04 14:08:58 +0200
commitb4af14f4c3a4fee50dd8ac2c61d2eb79fb648403 (patch)
treece8a0e20b2e24043a3dd2e011956d1bb8d364b3b /src/munia_proto.cc
parent37135daaaba2ee1945cb1b1163ddd68127b65b1e (diff)
parentf4595145308e24e3f6edcbaa2e30ee05fc90fd55 (diff)
Merge branch 'master' of https://git.oftal.dk/munia
Diffstat (limited to 'src/munia_proto.cc')
-rw-r--r--src/munia_proto.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/munia_proto.cc b/src/munia_proto.cc
index 36c6e5c..d9b068f 100644
--- a/src/munia_proto.cc
+++ b/src/munia_proto.cc
@@ -203,23 +203,27 @@ int callback_lws_task(struct libwebsocket_context * context,
TaskIdList::iterator id = ids.begin();
while(id != ids.end()) {
task_t task = task_manager.task(*id);
-
+
message_t createmsg = create_msg_create(task);
+ createmsg.tid = omi->observe.id;
message_t updatemsg = create_msg_update(task);
+ updatemsg.tid = omi->observe.id;
+
msgqueue[wsi].push(createmsg);
msgqueue[wsi].push(updatemsg);
-
+
id++;
}
} else if(omi->cmd == cmd::unobserve) {
TaskIdList ids = task_manager.subTasks(omi->observe.id);
- TaskIdList::iterator id = ids.begin();
- while(id != ids.end()) {
+ TaskIdList::reverse_iterator id = ids.rbegin();
+ while(id != ids.rend()) {
task_t task = task_manager.task(*id);
message_t removemsg = create_msg_remove(task);
+ removemsg.tid = omi->observe.id;
msgqueue[wsi].push(removemsg);
id++;
@@ -236,6 +240,8 @@ int callback_lws_task(struct libwebsocket_context * context,
clientid_t clientid = (*ci).first;
taskid_t tid = (*ci).second;
+ printf("Observer id of task: %d\n", tid);
+
message_t msg = *omi;
msg.tid = tid;