/** * 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); }
/** * 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); }
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); }
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"); }
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"); }