private async Task <int> HandleEvent(DataBaseWrapper db, AsyncNetwork network, User user, Event e) { if (e.type != "onMessage") { return(0); } var chat = db.Get <Chat> (e.msg); if (chat == null) { while (!await network.UpdateChats(db, user)) { await network.Authenticate(db, user); } chat = db.Get <Chat> (e.msg); } chat.time = e.time; db.Update(chat); var msg = new Message(); msg.conversation = chat.conversation; msg.author = e.author; msg.nick = e.nick; msg.text = e.text; msg.time = e.time; db.InsertIfNotContains <Message> (msg); ResetUpdateInterval(); if (e.msg != ActiveConversation && user.user != e.nick) { chat.Marked = true; db.Update(chat); if (chat.Notifications) { await Notify(network, e.nick, e.text); } } if (ChatActivity != null) { ChatActivity.OnUpdateRequested(); } else if (MainActivity != null) { MainActivity.OnUpdateRequested(); } return(0); }
public ServiceConnection(ChatActivity activity) { this.activityB = activity; }
public ServiceConnection (ChatActivity activity) { this.activityB = activity; }