public async Task enterMUCAsync(XMPPClient client, ChatTable muc, MUCChatInfoTable info) { MUCJoinHelper helper = new MUCJoinHelper(client, muc, info); TIMED_LIST.AddTimed(helper); await helper.enterRoomAsync(); }
public async Task EnterMucAsync(XMPPClient client, MucInfoModel info) { MucJoinHelper helper = new MucJoinHelper(client, info); TIMED_LIST.AddTimed(helper); await helper.EnterRoomAsync(); }
/// <summary> /// Sends the given message to the server or stores it until there is a connection to the server. /// </summary> /// <param name="msg">The message to send.</param> /// <param name="sendIfNotConnected">Sends the message if the underlaying TCP connection is connected to the server and ignores the connection state of the XMPPConnection.</param> /// <returns>True if the message got send and didn't got cached.</returns> public async Task <bool> SendAsync(AbstractMessage msg, bool sendIfNotConnected) { if (state == ConnectionState.CONNECTING) { ResetConnectionTimer(); } if (state != ConnectionState.CONNECTED && !sendIfNotConnected) { if (Logger.logLevel >= LogLevel.DEBUG) { Logger.Warn("[XMPPConnection2]: Did not send message, due to connection state is " + state + "\n" + msg.toXmlString()); } else { Logger.Warn("[XMPPConnection2]: Did not send message, due to connection state is " + state); } if (!sendIfNotConnected) { return(false); } } if (msg is IQMessage && msg.ID != null) { messageIdCache.AddTimed(msg.ID); } try { if (await TCP_CONNECTION.SendAsync(msg.toXmlString())) { // Only trigger onMessageSend(...) for chat messages: if (msg is MessageMessage m) { OnMessageSend(msg.ID, m.chatMessageId, false); } return(true); } else { Logger.Error("[XMPPConnection2]: Error during sending message for account: " + account.getBareJid()); } } catch (Exception e) { Logger.Error("[XMPPConnection2]: Error during sending message for account: " + account.getBareJid(), e); } return(false); }