Permalink
Browse files

Add logmsg app

  • Loading branch information...
1 parent 4dca586 commit 21f39629ae80c0bc6d5501b314f1eb9c3b0ec34c @zzdhidden zzdhidden committed Dec 31, 2010
Showing with 35 additions and 0 deletions.
  1. +32 −0 apps/ui.logmsg.js
  2. +1 −0 build/service.mk
  3. +1 −0 test/service.html
  4. +1 −0 test/unit/service.js
View
@@ -0,0 +1,32 @@
+/*
+* ui.logmsg
+*
+* Log user message to db.
+*
+* options:
+*
+* methods:
+*
+* events:
+*
+*/
+
+app("logmsg", {
+ init: function(options){
+ var ui = this, im = ui.im;
+ im.connection.bind("data",function(data){
+ var messages = data && data.messages;
+ for (var i = 0; i < messages.length; i++) {
+ var msg = messages[i];
+ msg.ticket = im.data.connection.ticket;
+ im.request({
+ type: 'post',
+ url: im.options.urls.logmsg,
+ cache: false,
+ data: msg
+ });
+ };
+ });
+ }
+});
+
View
@@ -4,6 +4,7 @@ PRODUCT_NAME = service
JS_APP_FILES = ${JS_SRC_DIR}/ui.buddy.js\
${APP_SRC_DIR}/ui.visitorstatus.js\
+ ${APP_SRC_DIR}/ui.logmsg.js\
CSS_APP_FILES = ${CSS_SRC_DIR}/buddy.css\
${CSS_SRC_DIR}/user.css\
View
@@ -58,6 +58,7 @@
<!-- webim ui end -->
<!-- webim apps start -->
<script type="text/javascript" src="../apps/ui.visitorstatus.js" ></script>
+ <script type="text/javascript" src="../apps/ui.logmsg.js" ></script>
<link href="../apps/service.css" media="all" type="text/css" rel="stylesheet"/>
<!-- webim apps end -->
View
@@ -37,6 +37,7 @@ test("webim.ui", 1, function() {
disable_group: true
});
ui.addApp("visitorstatus");
+ ui.addApp("logmsg");
//ui.addApp("setting", {"data": webim.setting.defaults.data});
ui.render();
//im.autoOnline() && im.online();

0 comments on commit 21f3962

Please sign in to comment.