Ejemplo n.º 1
0
 /**
 * Publish Message
 * @param message
 * @return JsonObject "{'status': 'ok'}" or "{'status': 'error', 'message': 'blabla'}"
 * @throws Exception
 */
 public JsonObject Publish(WebimMessage message)
 {
     Dictionary<string, object> data = NewData();
     message.feed(data);
     return HttpPost("/messages", data);
 }
Ejemplo n.º 2
0
 /**
 * Push Message, no need to be online
 * @param from
 * @param message
 * @return JsonObject "{'status': 'ok'}" or "{'status': 'error', 'message': 'blabla'}"
 * @throws Exception
 */
 public JsonObject Publish(String from, WebimMessage message)
 {
     Dictionary<string, object> data = NewData();
     data.Add("from", from);
     message.feed(data);
     return HttpPost("/messages", data);
 }
Ejemplo n.º 3
0
 public void InsertHistory(string uid, WebimMessage msg)
 {
     HistoryEntity entity = HistoryEntity.New();
     entity.FromUser = uid;
     entity.Send = (msg.Offline ? 0 : 1);
     entity.Nick = msg.Nick;
     entity.Type = msg.Type;
     entity.ToUser = msg.To;
     entity.Body = msg.Body;
     entity.Style = msg.Style;
     entity.Timestamp = msg.Timestamp;
     historyRepository.Insert(entity);
 }
Ejemplo n.º 4
0
 public void InsertHistory(string uid, WebimMessage msg)
 {
     // TODO Auto-generated method stub
 }
 public ActionResult Message()
 {
     long uid = webimService.CurrentUid();
     WebimClient c = webimService.CurrentClient(Request["ticket"]);
     string type = Request["type"];
     string offline = Request["offline"];
     string to = Request["to"];
     string body = Request["body"];
     string style = Request["style"];
     if (style == null) { style = ""; }
     WebimMessage msg = new WebimMessage(type, to, c.Endpoint.Nick, body, style, Timestamp());
     c.Publish(msg);
     webimService.InsertHistory(uid, offline, msg);
     return Json("ok");
 }
Ejemplo n.º 6
0
 public void InsertHistory(long uid, string offline, WebimMessage msg)
 {
     WebimHistory h = new WebimHistory();
     h.From = uid.ToString();
     h.Send = (offline == "true" ? 0 : 1);
     h.Nick = msg.Nick;
     h.Type = msg.Type;
     h.To = msg.To;
     h.Body = msg.Body;
     h.Style = msg.Style;
     h.Timestamp = msg.Timestamp;
     historyDao.Insert(h);
 }
 public ActionResult Message()
 {
     string uid = CurrentUid();
     WebimClient c = CurrentClient(Request["ticket"]);
     string type = Request["type"];
     string offline = Request["offline"];
     string to = Request["to"];
     string body = Request["body"];
     string style = Request["style"];
     if (style == null) { style = ""; }
     WebimMessage msg = new WebimMessage(type, to, c.Endpoint.Nick, body, style, Timestamp());
     msg.Offline = offline.Equals("true") ? true : false;
     c.Publish(msg);
     if (body != null && !body.StartsWith("webim-event:")) {
         model.InsertHistory(uid, msg);
     }
     return Json("ok");
 }