private void SendMsg() { if (!Util_Buddy.GetCurrentBuddy().PresenceInfo.IsOnline) { Util_Misc.NotifyMsgToConversation(this.CurrentSessionTabItem.CommunitySession.Community.Id, true, CoreMessenger.Instance.MiscHelper.TXLoadString("CF_SELF_OFFLINE")); } else if (this.InputBox.GetTextLength() > 0x1194) { Util_Misc.NotifyMsgToConversation(this.CurrentSessionTabItem.CommunitySession.Community.Id, true, CoreMessenger.Instance.MiscHelper.TXLoadString("CF_EDITMSG_LARGE_MESSAGE")); } else { int imageCount = 0; MessagePack messagePack = this.InputBox.CreateMessagePack(out imageCount); if (imageCount > 1) { Util_Misc.NotifyMsgToConversation(this.CurrentSessionTabItem.CommunitySession.Community.Id, true, CoreMessenger.Instance.MiscHelper.TXLoadString("CF_Group_Image_TooManyImage")); } else if ((messagePack != null) && (this.CurrentSessionTabItem != null)) { this.CurrentSessionTabItem.SendMessage(messagePack); Buddy currentBuddy = Util_Buddy.GetCurrentBuddy(); this.CurrentSessionTabItem.AddMsg(currentBuddy, TimeConverter.Now, messagePack); try { this.InputBox.Document.Blocks.Clear(); } catch (Exception) { } } } }
private void AddMsgToOutputBox(IMMessage imMessage) { Buddy sender = imMessage.Sender; string senderName = null; if (sender != null) { CommunityMember member = this.CurrentSessionTabItem.CommunitySession.Community.Members.FindMember(sender.Uin); if (member != null) { senderName = member.CombineName; } else { senderName = sender.CombineName; } } this.OutputBox.AddMsgToOutputBox(imMessage, senderName, null); IMMessage blockURLWarningMsg = Util_Misc.GetBlockURLWarningMsg(imMessage.MessagePack.Header, this.OutputBox.IsCommunity); if (blockURLWarningMsg != null) { this.OutputBox.AddMsgToOutputBox(blockURLWarningMsg, senderName, null); } }
/// <summary> /// 发送消息 /// </summary> private void SendMsg() { if (!Util_Buddy.IsOnlineStatus()) { Util_Misc.NotifyMsgToConversation(this.CurrentIMSession.Buddy.Uin, false, CoreMessenger.Instance.MiscHelper.TXLoadString("CF_SELF_OFFLINE")); } else if (this.InputBox.Text.Length > 0x1194) { Util_Misc.NotifyMsgToConversation(this.CurrentIMSession.Buddy.Uin, false, CoreMessenger.Instance.MiscHelper.TXLoadString("CF_EDITMSG_LARGE_MESSAGE")); } else { MessagePack messagePack = CreateMessagePack(); if ((messagePack != null) && (this.CurrentIMSession != null)) { this.CurrentIMSession.SendMessage(messagePack); Buddy currentBuddy = Util_Buddy.GetCurrentBuddy(); this.CurrentIMSession.AddMsg(currentBuddy, TimeConverter.Now, messagePack); try { this.InputBox.Text = ""; } catch (Exception) { } } } }
private void AddMsgToOutputBox(IMMessage imMessage) { string senderName = (imMessage.Sender != null) ? imMessage.Sender.NickName : null; this.OutputBox.AddMsgToOutputBox(imMessage, senderName, new InputBox.AddMsgToOutputBoxCallBackHandler(this.AddMsgToOutputBoxCallBack)); IMMessage blockURLWarningMsg = Util_Misc.GetBlockURLWarningMsg(imMessage.MessagePack.Header, this.OutputBox.IsCommunity); if (blockURLWarningMsg != null) { this.OutputBox.AddMsgToOutputBox(blockURLWarningMsg, senderName, null); } }
private void session_SendMessageCompleted(object sender, CommandKeyedCallbackArgs <MessagePack> e) { uint uin = 0; bool isCommunityMsg = false; if (sender == this._contactSession) { uin = this._contactSession.Uin; isCommunityMsg = false; } else if (sender == this._communitySession) { uin = this._communitySession.Community.Id; isCommunityMsg = true; } else { return; } if (e.Code == CallbackCode.Succeeded) { if (((e.DataCallback != null) && (TXDataHelper.GetDWord(e.DataCallback, SessionMsg.CCSenderExSendData_dwResult) == 7)) && (TXDataHelper.GetDWord(e.DataCallback, SessionMsg.CCSenderExSendData_SensitiveInfo_dwURLID) > 0)) { ushort word = TXDataHelper.GetWord(e.DataCallback, SessionMsg.wUnlawfulURLTipsID); string str = ComponentManager.GetGrayURLMgr().QueryBlockURLWarningMsg(false, word); if (!string.IsNullOrEmpty(str)) { Util_Misc.NotifyMsgToConversation(uin, isCommunityMsg, str); } } } else { string msgAbstract = CoreMessenger.Instance.MiscHelper.GetMsgAbstract(e.Key.Key); string str4 = CoreMessenger.Instance.MiscHelper.TXLoadString("CF_SEND_C2CMSG_FAILED").Replace("$MSG$", msgAbstract); if (!string.IsNullOrEmpty(str4)) { Util_Misc.NotifyMsgToConversation(uin, isCommunityMsg, str4); } } }