Пример #1
0
        public static bool IsSupport(this ChatMsg msg)
        {
            if (msg == null)
            {
                return(false);
            }
            ContactMgr.UserType type = ContactMgr.getUserType(msg.strTalker);
            if (msg.strTalker == "sysnotice")
            {
                return(false);
            }
            if (msg.strTalker == "pc_share")
            {
                return(false);
            }
            switch (type)
            {
            case ContactMgr.UserType.UserTypeChatRoom:
            case ContactMgr.UserType.UserTypeNormal:
            case ContactMgr.UserType.UserTypeQQ:
                return(true);
            }
            switch (type)
            {
            case ContactMgr.UserType.UserTypeQQ:
                return(true);

            case ContactMgr.UserType.UserTypeBottle:
                return(true);
            }
            //return (((type == ContactMgr.UserType.UserTypePlugin) && (((msg.strTalker == "weixin") || ((msg.strTalker == "fmessage") && (FMsgMgr.getFMsgType(msg) == FMsgType.other))) || (((msg.strTalker == ConstantValue.TAG_BLOGAPP) || (msg.strTalker == ConstantValue.TAG_NEWS)) || (msg.strTalker == ConstantValue.TAG_QQMAIL)))) || msg.IsPushMsg());
            return(((type == ContactMgr.UserType.UserTypePlugin) && (((msg.strTalker == "weixin") || ((msg.strTalker == "fmessage"))) || (((msg.strTalker == ConstantValue.TAG_BLOGAPP) || (msg.strTalker == ConstantValue.TAG_NEWS)) || (msg.strTalker == ConstantValue.TAG_QQMAIL)))) || msg.IsPushMsg());
        }
Пример #2
0
    public void AddMsg(string text)
    {
        ChatMsg msg = new ChatMsg();

        msg.text = text;
        msgs.AddLast(msg);
    }
Пример #3
0
        private void ExecuteSendTextCommand(string strText)
        {
            var MessageCollection = ConnectionHelper.DB.GetCollection <MessageEntity>("MessageEntity");
            var NewMessage        = new MessageEntity(this.RoomSID, strText, (int)MsgStatus.Sending, (int)ContentType.Text, AuthRepository.MQKeyInfo.UserSid, 0, null);

            MessageCollection.Save(NewMessage);

            var SendMessage = new ChatMsg(NewMessage.Id.ToString(), null, this.RoomSID, strText, ContentType.Text, 0, MsgStatus.Sending, 0,
                                          AuthRepository.MQKeyInfo.NickName, AuthRepository.MQKeyInfo.ThumbnailPath, this.m_AnonymousThumbnailDictionary[AuthRepository.MQKeyInfo.UserSid]);

            this.Messages.Add(SendMessage);
            this.EndSendTextCommand(SendMessage);

            Task.Run(() =>
            {
                var RoomCollection = ConnectionHelper.DB.GetCollection <RoomEntity>("RoomEntity");
                var FindRoomQuery  = Query <RoomEntity> .EQ(r => r.Sid, this.RoomSID);
                var FindedRoom     = RoomCollection.FindOne(FindRoomQuery);

                if (null != FindedRoom)
                {
                    var ActiveMemberSids = FindedRoom.ActiveMemberSids;
                    ActiveMemberSids.Remove(AuthRepository.MQKeyInfo.UserSid);
                    SendingMsg WillSendMsg = new SendingMsg(ActiveMemberSids, this.RoomSID, (int)ContentType.Text,
                                                            strText, AuthRepository.MQKeyInfo.UserSid, SendMessage);

                    var Result = this.m_SendMessageService.SendMessage(WillSendMsg);
                    this.UpdateSendMessage(Result, SendMessage, MessageCollection, strText, NewMessage.Id.ToString());
                }
            });
        }
Пример #4
0
 public static void SendChatMsg(ChatMsg Type, Languages Language, string Message)
 {
     if (Type != ChatMsg.CHAT_MSG_WHISPER || Type != ChatMsg.CHAT_MSG_CHANNEL)
     {
         SendChatMsg(Type, Language, Message, "");
     }
 }
Пример #5
0
 protected override void onFailed(SendMsgRequest request, SendMsgResponse response)
 {
     if ((base.getLastError() == PackResult.PACK_TIMEOUT) && (mMsgRetryTimes < 1))
     {
         Log.e("NetSceneSendMsg", "doScene: send message timeout! retry doscene mMsgRetryTimes = " + mMsgRetryTimes);
         if ((request != null) && (request.Count > 0))
         {
             for (int i = 0; i < request.Count; i++)
             {
                 string clientMsgId = request.GetList(i).ClientMsgId;
                 if (!string.IsNullOrEmpty(clientMsgId) && sendingHash.ContainsKey(clientMsgId))
                 {
                     ChatMsg msg = sendingHash[clientMsgId];
                     if (msg != null)
                     {
                         List <ChatMsg> chatMsgList = new List <ChatMsg> {
                             msg
                         };
                         this.doScene(chatMsgList, 1);
                     }
                 }
             }
         }
         mMsgRetryTimes++;
     }
     else
     {
         Log.e("NetSceneSendMsg", "send msg fail because of net error");
         mMsgRetryTimes = 0;
         this.doSendMsgFailProc(request, null);
     }
 }
Пример #6
0
        public bool Execute(JHSNetworkMessage msg)
        {
            ChatMsg packet = msg.ReadMessage <ChatMsg>();

            if (packet != null)
            {
                if (userManager == null)
                {
                    userManager = UserManager.Instance;
                }

                if (chatmanager == null)
                {
                    chatmanager = ChatManager.Instance;
                }

                uint connectionId = msg.conn.connectionId;

                User user = userManager.GetUserByConnectionId(connectionId);
                if (user != null)
                {
                    chatmanager.SendToAll(user.UserName, packet.msg, JHSTime.TimeStamp);
                }
            }

            return(true);
        }
Пример #7
0
        public static bool IsSupportConversation(this ChatMsg msg)
        {
            if (msg == null)
            {
                return(false);
            }
            ContactMgr.UserType type = ContactMgr.getUserType(msg.strTalker);
            if (msg.strTalker == "sysnotice")
            {
                return(false);
            }
            if (msg.strTalker == "pc_share")
            {
                return(false);
            }
            if ((type == ContactMgr.UserType.UserTypeNormal) && ContactHelper.IsInVerifiedEntryContact(msg.strTalker))
            {
                return(false);
            }
            if (type == ContactMgr.UserType.UserTypeQQ)
            {
                return(false);
            }
            if (type == ContactMgr.UserType.UserTypeBottle)
            {
                return(false);
            }
            //if ((((type != ContactMgr.UserType.UserTypeChatRoom) && (type != ContactMgr.UserType.UserTypeNormal)) && (type != ContactMgr.UserType.UserTypeQQ)) && ((type != ContactMgr.UserType.UserTypePlugin) || (((msg.strTalker != "weixin") && ((msg.strTalker != "fmessage") || (FMsgMgr.getFMsgType(msg) != FMsgType.other))) && ((!(msg.strTalker == ConstantValue.TAG_BLOGAPP) && !(msg.strTalker == ConstantValue.TAG_NEWS)) && !(msg.strTalker == ConstantValue.TAG_QQMAIL)))))
            if ((((type != ContactMgr.UserType.UserTypeChatRoom) && (type != ContactMgr.UserType.UserTypeNormal)) && (type != ContactMgr.UserType.UserTypeQQ)) && ((type != ContactMgr.UserType.UserTypePlugin) || (((msg.strTalker != "weixin") && ((msg.strTalker != "fmessage"))) && ((!(msg.strTalker == ConstantValue.TAG_BLOGAPP) && !(msg.strTalker == ConstantValue.TAG_NEWS)) && !(msg.strTalker == ConstantValue.TAG_QQMAIL)))))

            {
                return(false);
            }
            return(true);
        }
Пример #8
0
        private void OnChatMessage(ref ChatMsg message, ref bool cancel)
        {
            // TODO player manager to cache these objects
            var player = new Player {
                Name = message.CustomAuthorName, SteamId = message.Author
            };

            var text = message.Text;

            if (_commands.IsCommand(text))
            {
                _commands.Execute(player, text.TrimStart(CommandPrefix), s => SendMessageTo(s, player.SteamId));
                cancel = true;
            }
            else
            {
                var e = new ChatMessageEvent(message.Author, message.CustomAuthorName, text);
                ChatMessageReceived?.Invoke(ref e);
                cancel |= e.IsCancelled;

                if (!cancel)
                {
                    _chatLog.Info($"{e.SenderName}: {e.Content}");
                }
            }
        }
Пример #9
0
 /// <inheritdoc />
 public void SendMessageAsOther(ulong authorId, string message, ulong targetSteamId = 0)
 {
     if (targetSteamId == Sync.MyId)
     {
         RaiseMessageRecieved(new TorchChatMessage(authorId, message, ChatChannel.Global, 0));
         return;
     }
     if (MyMultiplayer.Static == null)
     {
         if ((targetSteamId == MyGameService.UserId || targetSteamId == 0) && HasHud)
         {
             MyHud.Chat?.ShowMessage(authorId == MyGameService.UserId ?
                                     (MySession.Static.LocalHumanPlayer?.DisplayName ?? "Player") : $"user_{authorId}", message);
         }
         return;
     }
     if (MyMultiplayer.Static is MyDedicatedServerBase dedicated)
     {
         var msg = new ChatMsg()
         {
             Author = authorId, Text = message
         };
         _dedicatedServerBaseSendChatMessage.Invoke(ref msg);
         _dedicatedServerBaseOnChatMessage.Invoke(dedicated, new object[] { msg });
     }
 }
Пример #10
0
        public static bool Prefix(ref ChatMsg msg)
        {
            var cancel = false;

            ChatMessageReceived?.Invoke(ref msg, ref cancel);
            return(!cancel);
        }
Пример #11
0
        public bool doSceneResume(ChatMsg msg)
        {
            if (msg == null)
            {
                return(false);
            }
            string strClientMsgId = msg.strClientMsgId;

            Log.i("UploadVideoService", "cmd to scene resume,  clientMsgId = " + strClientMsgId);
            if (UploadVideoContextMgr.getInstance().findByClientMsgID(strClientMsgId) != null)
            {
                Log.e("UploadVideoService", "already running,clean first. " + strClientMsgId);
                UploadVideoContextMgr.getInstance().clearnFinishedContext();
                if (UploadVideoContextMgr.getInstance().findByClientMsgID(strClientMsgId) != null)
                {
                    Log.e("UploadVideoService", "already running, ignored! clientMsgId = " + strClientMsgId);
                    return(false);
                }
            }
            //if (!resumeByClientMsgID(msg))
            //{
            //    return false;
            //}
            checkReadyContextDispatcher();
            return(true);
        }
Пример #12
0
        static void Main(string[] args)
        {
            IHubProxy _hub;
            string    url = @"http://localhost:8080/";
            string    userName;

            var connection = new HubConnection(url);

            _hub = connection.CreateHubProxy("ChatHub");
            connection.Start().Wait();

            //Event subscription
            _hub.On <ChatMsg>("ReceiveMsg", x => OnReceiveMsg(x));

            Console.WriteLine("Enter Name:");
            userName = Console.ReadLine();

            Console.WriteLine("Welcome to the chat " + userName + "\n");

            //Msg object to send
            ChatMsg msg = new ChatMsg();

            msg.Sender = userName;

            string line;

            while ((line = Console.ReadLine()) != null)
            {
                msg.MsgBody = line;
                _hub.Invoke <ChatMsg>("SendMsg", msg).Wait();
            }
        }
Пример #13
0
        private void Instance_MessageRecieved(ChatMsg msg, ref bool sendToOthers)
        {
            var message = ChatMessage.FromChatMsg(msg);

            ChatHistory.Add(message);
            MessageReceived?.Invoke(message, ref sendToOthers);
        }
Пример #14
0
 public bool addVoiceChatMsg(bool isShortVideo)
 {
     if (this.mChatMsg != null)
     {
         return(false);
     }
     this.mChatMsg           = new ChatMsg();
     this.mChatMsg.strMsg    = "";
     this.mChatMsg.strTalker = this.mVideoTrans.strToUserName;
     if (isShortVideo)
     {
         this.mChatMsg.nMsgType = 0x3e;
     }
     else
     {
         this.mChatMsg.nMsgType = 0x2b;
     }
     this.mChatMsg.nStatus        = convertStatus(this.mStatus);
     this.mChatMsg.nCreateTime    = (long)(Util.getNowMilliseconds() / 1000.0);
     this.mChatMsg.nIsSender      = 1;
     this.mChatMsg.strClientMsgId = this.mVideoTrans.strClientMsgId;
     this.mChatMsg.strThumbnail   = this.mVideoTrans.strThumbnail;
     this.mChatMsg.strPath        = this.mVideoTrans.strImagePath;
     this.updateChatMsgContent();
     //StorageMgr.chatMsg.addMsg(this.mChatMsg);
     this.mVideoTrans.nMsgLocalID = this.mChatMsg.nMsgLocalID;
     this.updateToVideoTransMsg();
     return(true);
 }
Пример #15
0
        /// <summary>
        /// 显示发出的消息
        /// </summary>
        /// <param name="msg"></param>
        private void ShowSendMsg(ChatMsgData msg)
        {
            try
            {
                ChatMsg chatmsg = new ChatMsg();
                chatmsg.Image = _me.Icon;
                //此处的Paragraph必须是新New的
                if (msg.Type == 9)
                {
                    Paragraph imgper = new Paragraph();
                    imgper.Inlines.Add(new InlineUIContainer(msg.MsgImg));
                    chatmsg.Message.Blocks.Add(imgper);
                }
                else
                {
                    StrToFlDoc(msg.Msg, chatmsg.Message);
                }

                chatmsg.FlowDir = FlowDirection.RightToLeft;
                chatmsg.TbColor = (System.Windows.Media.Brush) new BrushConverter().ConvertFromString("#FF98E165");
                ChatList.Add(chatmsg);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Пример #16
0
        /// <summary>
        /// 显示收到的信息
        /// </summary>
        /// <param name="msg"></param>
        private void ShowReceiveMsg(ChatMsgData msg)
        {
            ChatMsg chatmsg = new ChatMsg();

            Contact_all.ForEach(p =>
            {
                if (p is ChatUser)
                {
                    if ((p as ChatUser).UserName == msg.From)
                    {
                        chatmsg.Image = (p as ChatUser).Icon;
                        return;
                    }
                }
            });

            if (msg.Type == 9)
            {
                Paragraph imgper = new Paragraph(new Floater(new BlockUIContainer(msg.MsgImg)));
                chatmsg.Message.Blocks.Add(imgper);
            }
            else
            {
                StrToFlDoc(msg.Msg, chatmsg.Message);
            }

            chatmsg.FlowDir = FlowDirection.LeftToRight;
            chatmsg.TbColor = System.Windows.Media.Brushes.White;
            ChatList.Add(chatmsg);
        }
Пример #17
0
        public void Initialize(ChatMsg chatType, Language language, WorldObject sender, WorldObject receiver, string message, uint achievementId = 0, string channelName = "", Locale locale = Locale.enUS, string addonPrefix = "")
        {
            // Clear everything because same packet can be used multiple times
            Clear();

            SenderGUID.Clear();
            SenderAccountGUID.Clear();
            SenderGuildGUID.Clear();
            PartyGUID.Clear();
            TargetGUID.Clear();
            SenderName = "";
            TargetName = "";
            _ChatFlags = ChatFlags.None;

            SlashCmd  = chatType;
            _Language = language;

            if (sender)
            {
                SetSender(sender, locale);
            }

            if (receiver)
            {
                SetReceiver(receiver, locale);
            }

            SenderVirtualAddress = Global.WorldMgr.GetVirtualRealmAddress();
            TargetVirtualAddress = Global.WorldMgr.GetVirtualRealmAddress();
            AchievementID        = achievementId;
            Channel  = channelName;
            Prefix   = addonPrefix;
            ChatText = message;
        }
Пример #18
0
        public ActionResult SetMessage()
        {
            //1.0 接收ajax发送过来的数据
            string touserid   = Request.Params["touserid"];
            string torealname = Request.Params["torealname"];
            string msgbody    = Request.Params["msgbody"];

            //2.0 参数合法性验证

            ChatMsg msg = new ChatMsg()
            {
                ToUserId     = int.Parse(touserid),
                ToRealName   = torealname,
                FromRealName = UserMgr.GetCurrentUserInfo().uRealName
                ,
                FromUserId  = UserMgr.GetCurrentUserInfo().uID,
                SendTime    = DateTime.Now,
                MessageBody = msgbody
            };

            //3.0包装成chatmsg对象发送给WCF聊天服务
            ChatMgrClient c = new ChatMgrClient();

            c.SetMessage(msg);

            return(WriteSuccess("消息发送成功"));
        }
Пример #19
0
        public void RelayTaggedMessage(string message)
        {
            this.Locker.WaitOne();

            if (this.CurrentMatch == null)
            {
                this.Locker.Release();
                return;
            }

            var msg = new ChatMsg
            {
                MsgId      = this.CurrentMatch.MsgCount,
                MsgContent = message
            };

            Player opponent = this.CurrentMatch.GetOpponent(this);

            var tryAction = new Action(async() =>
            {
                await Task.WhenAll(
                    this.Client.WriteMessageToChatAsync(msg, true),
                    opponent.Client.WriteMessageToChatAsync(msg, false));
            });

            TryToRunIt(tryAction);

            this.CurrentMatch.MsgCount++;

            this.Locker.Release();
        }
Пример #20
0
        public ChatMsgDataItem(ChatMsg chatMsg)
        {
            DateTime dateTimeFromTimeStamp = Miscs.GetDateTimeFromTimeStamp(chatMsg.get_time());
            string   nickname = !string.IsNullOrEmpty(chatMsg.get_nickname()) ? chatMsg.get_nickname() : ("ID. " + chatMsg.get_uid());

            this.Init((int)chatMsg.get_uid(), nickname, dateTimeFromTimeStamp, chatMsg.get_msg(), Type.MSG);
        }
Пример #21
0
            public new void Deserialize(ref byte[] data)
            {
                msgSOF  = BitConverter.ToInt32(data, 0);
                msgID   = BitConverter.ToInt32(data, 4);
                msgSize = BitConverter.ToInt32(data, 8);
                msgType = BitConverter.ToInt32(data, 12);
                msgErr  = BitConverter.ToInt32(data, 16);

                msgUser = Encoding.ASCII.GetString(data, 20, 50).TrimEnd('\0');
                msgTime = Encoding.ASCII.GetString(data, 70, 50).TrimEnd('\0');
                ext1    = Encoding.ASCII.GetString(data, 120, 50).TrimEnd('\0');
                ext2    = Encoding.ASCII.GetString(data, 170, 50).TrimEnd('\0');

                int headLen = HEADER.HeaderSize();

                msgCount = BitConverter.ToInt32(data, headLen);
                msgs     = new ChatMsg[msgCount];
                for (int i = 0; i < msgCount; ++i)
                {
                    int    msgSize = Marshal.SizeOf(typeof(ChatMsg));
                    byte[] dest    = new byte[msgSize];
                    int    off     = headLen + 4 + (i * msgSize);
                    Array.Copy(data, off, dest, 0, msgSize);

                    msgs[i] = new ChatMsg();
                    var gch = GCHandle.Alloc(dest, GCHandleType.Pinned);
                    Marshal.PtrToStructure(gch.AddrOfPinnedObject(), msgs[i]);
                    gch.Free();
                }
            }
Пример #22
0
 internal void AddMsg(ChatMsg msg)
 {
     Observable.Start(() =>
     {
         m_ReceivedMsgs.Add(msg);
     }, RxApp.MainThreadScheduler);
 }
Пример #23
0
        public ChatMsg OnChatMessage(MyPacket packet)
        {
            m_receiveStream.ResetRead(packet);
            ChatMsg msg = VRage.Serialization.MySerializer.CreateAndRead <ChatMsg>(m_receiveStream);

            return(msg);
        }
Пример #24
0
        private static bool PrefixMessageProcessing(ref ChatMsg msg)
        {
            var consumed = false;

            ChatManager.RaiseMessageRecieved(msg, ref consumed);
            return(!consumed);
        }
Пример #25
0
 public void SendChatMsg(ChatMsg Type, Languages Language, string Message)
 {
     if (Type != ChatMsg.Whisper || Type != ChatMsg.Channel)
     {
         SendChatMsg(Type, Language, Message, "");
     }
 }
Пример #26
0
            public async Task <ChatMsgDto> Handle(Command request, CancellationToken cancellationToken)
            {
                var game = await _context.Games.FirstOrDefaultAsync(g => g.Code == request.GameCode.ToUpper());

                if (game == null)
                {
                    throw new RestException(HttpStatusCode.NotFound, new { Game = "Game not found" });
                }

                var user = await _context.Users.SingleOrDefaultAsync(x => x.UserName == request.UserName);

                var chatMsg = new ChatMsg
                {
                    Author    = user,
                    Game      = game,
                    Body      = request.Body,
                    CreatedAt = DateTime.Now
                };

                game.ChatMsgs.Add(chatMsg);

                var success = await _context.SaveChangesAsync() > 0;

                if (success)
                {
                    return(_mapper.Map <ChatMsgDto>(chatMsg));
                }

                throw new Exception("Problem saving changes");
            }
Пример #27
0
 public bool checkAddVoiceChatMsg()
 {
     if ((this.mChatMsg != null) || this.mIsCancelled)
     {
         return(false);
     }
     this.mChatMsg                = new ChatMsg();
     this.mChatMsg.strMsg         = "";
     this.mChatMsg.strTalker      = this._mMsgTrans.strToUserName;
     this.mChatMsg.nMsgType       = 0x22;
     this.mChatMsg.nStatus        = this.convertStatus(this.mStatus);
     this.mChatMsg.nCreateTime    = this.mCreateTime;
     this.mChatMsg.nIsSender      = 1;
     this.mChatMsg.strClientMsgId = this.mClientMsgId;
     this.updateChatMsgContent();
     //if (StorageMgr.chatMsg.addMsg(this.mChatMsg))
     //{
     //    this._mMsgTrans.nMsgLocalID = this.mChatMsg.nMsgLocalID;
     //    this.updateToVoiceTransMsg();
     //}
     //else
     //{
     //    this.mChatMsg = null;
     //    Log.e("UploadVoiceContext", "add chat-msg failed.");
     //}
     //Log.e("UploadVoiceContext", "add chat-msg failed. return true");
     return(true);
 }
Пример #28
0
        public static ChatMsg ToChatMsg(this Entity entity)
        {
            var msg = new ChatMsg();

            Assign(msg, entity);
            return(msg);
        }
Пример #29
0
        public static Entity ToEntity(this ChatMsg msg)
        {
            var entity = EntityManager.Instance.CreateEntity(msg.Id);

            Assign(entity, msg);
            return(entity);
        }
Пример #30
0
        public async Task <bool> Message(ChatMsg msg)
        {
            messages.Add(msg);
            await stream.OnNextAsync(msg);

            return(true);
        }
Пример #31
0
    //将消息体编码成二进制流
    private byte[] serial(string sender, string msg)
    {
        ChatMsg chatMsg = new ChatMsg();
        chatMsg.sender = sender;
        chatMsg.msg = msg;

        using (MemoryStream ms = new MemoryStream())
        {
            Serializer.Serialize<ChatMsg>(ms, chatMsg);
			byte[] data = new byte[ms.Length];
			ms.Position= 0;
            ms.Read(data, 0, data.Length);
            return data;
        }
    }
Пример #32
0
        public void Display_Chat(string username, string message, ChatMsg type, string from)
        {
            string text = "";
            string u = username;
            string m = message;
            ChatMsg t = type;
            string c = from;

            switch (t)
            {
                case ChatMsg.CHAT_MSG_SAY:
                    text = String.Format("<{0}> says: {1}\r\n", u, m);
                    break;
                case ChatMsg.CHAT_MSG_WHISPER:
                    text = String.Format("[{0}] whispers: {1}\r\n", u, m);
                    break;
                case ChatMsg.CHAT_MSG_WHISPER_INFORM:
                    text = String.Format("You whisper to [{0}]: {1}\r\n", u, m);
                    break;
                case ChatMsg.CHAT_MSG_YELL:
                    text = String.Format("[{0}] yells: {1}\r\n", u, m);
                    break;
                case ChatMsg.CHAT_MSG_CHANNEL:
                    text = String.Format("[{0}] <{1}>: {2}\r\n", c, u, m);
                    break;
                case ChatMsg.CHAT_MSG_SYSTEM:
                    text = String.Format("SYSTEM: {0}\r\n", m);
                    break;
                case ChatMsg.CHAT_MSG_EMOTE:
                    text = String.Format("[{0}] emotes: {1}\r\n", u, m);
                    break;
                default:
                    text = String.Format("CHAT TYPE {2} - [{0}] says: {1}\r\n", u, m, t);
                    break;
             }

             AddText(text);
        }
Пример #33
0
 protected abstract void OnChatMessage(ref ChatMsg msg, ulong sender);
Пример #34
0
        public ChatTab(string ident, ChatMsg type)
        {
            #region Do NOT open this shit.
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.richTextBox2 = new System.Windows.Forms.RichTextBox();
            this.button3 = new System.Windows.Forms.Button();
            this.Controls.Add(this.button3);
            this.Controls.Add(this.richTextBox2);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.richTextBox1);
            this.Controls.Add(this.listBox1);
            this.Location = new System.Drawing.Point(4, 22);
            this.Name = "";
            this.Padding = new System.Windows.Forms.Padding(3);
            this.Size = new System.Drawing.Size(584, 446);
            this.TabIndex = 1;
            this.Text = "Chat Window";
            this.UseVisualStyleBackColor = true;
            //
            // listBox1
            //
            this.listBox1.FormattingEnabled = true;
            this.listBox1.Location = new System.Drawing.Point(435, 6);
            this.listBox1.Name = "listBox1";
            this.listBox1.Size = new System.Drawing.Size(143, 160);
            this.listBox1.TabIndex = 0;
            //
            // richTextBox1
            //
            this.richTextBox1.Location = new System.Drawing.Point(5, 6);
            this.richTextBox1.Name = "richTextBox1";
            this.richTextBox1.Size = new System.Drawing.Size(429, 343);
            this.richTextBox1.TabIndex = 2;
            this.richTextBox1.Text = "";
            this.richTextBox1.Multiline = true;
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(440, 172);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(138, 23);
            this.button1.TabIndex = 3;
            this.button1.Text = "Chat";
            this.button1.UseVisualStyleBackColor = true;

            //
            // button2
            //
            this.button2.Location = new System.Drawing.Point(440, 201);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(138, 23);
            this.button2.TabIndex = 4;
            this.button2.Text = "Close Tab";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // richTextBox2
            //
            this.richTextBox2.Location = new System.Drawing.Point(5, 367);
            this.richTextBox2.Name = "richTextBox2";
            this.richTextBox2.Size = new System.Drawing.Size(428, 67);
            this.richTextBox2.TabIndex = 5;
            this.richTextBox2.Text = "";
            this.richTextBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(richTextBox2_KeyPress);
            //
            // button3
            //
            this.button3.Location = new System.Drawing.Point(440, 367);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(137, 66);
            this.button3.TabIndex = 6;
            this.button3.Text = "Send";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            #endregion

            Identificator = ident;
            Type = type;
            this.Text = String.Format("[{0}] {1}", type, Identificator);
        }
        public override void SendChatMessage(string text)
        {
            ChatMsg msg = new ChatMsg();
            msg.Text = text;
            msg.Author = Sync.MyId;

            OnChatMessage(ref msg, MySteam.AppId);
            SendControlMessage(ServerId, ref msg);
        }
Пример #36
0
        public override void SendChatMessage(string text)
        {
            ChatMsg msg = new ChatMsg();
            msg.Text = text;
            msg.Author = MySteam.UserId;

            // This will send the message to every client except message author
            OnChatMessage(ref msg, MySteam.UserId);
        }
Пример #37
0
        public void SendChatMsg(ChatMsg Type, Languages Language, string Message, string To)
        {
            WoWWriter wr = new WoWWriter(OpCode.CMSG_MESSAGECHAT);
            wr.Write((UInt32)Type);
            wr.Write((UInt32)Languages.LANG_ORCISH);
            if ((Type == ChatMsg.CHAT_MSG_WHISPER || Type == ChatMsg.CHAT_MSG_CHANNEL) && To != "")
                wr.Write(To);
            wr.Write(Message);

            Send(wr.ToArray());
        }
Пример #38
0
 public void SendChatMsg(ChatMsg Type, Languages Language, string Message)
 {
     if (Type != ChatMsg.CHAT_MSG_WHISPER || Type != ChatMsg.CHAT_MSG_CHANNEL)
         SendChatMsg(Type, Language, Message, "");
     else
         BoogieCore.Log(LogType.Error, "Got whisper message to send without destination");
 }
Пример #39
0
 public void SendChatMsg(ChatMsg Type, Languages Language, string Message)
 {
     if (Type != ChatMsg.CHAT_MSG_WHISPER || Type != ChatMsg.CHAT_MSG_CHANNEL)
         SendChatMsg(Type, Language, Message, "");
 }
Пример #40
0
        private void HandleChatMsg(ChatMsg type, string channel, string user, string msg)
        {
            ChatTab found = new ChatTab();

            if (type == ChatMsg.Say || type == ChatMsg.Yell)
            {
                found = Tabs.Find(s => s.Type == ChatMsg.Say);
            }

            else if (type == ChatMsg.System || type == ChatMsg.System2)
            {
                type = ChatMsg.System;
                found = Tabs.Find(s => s.Type == ChatMsg.System);
            }

            else if (type == ChatMsg.Guild)
            {
                found = Tabs.Find(s => s.Type == type);
            }

            else if (type == ChatMsg.Channel)
            {
                found = Tabs.Find(s => s.Identificator == channel);
            }

            else if (type == ChatMsg.Whisper)
            {
                found = Tabs.Find(s => s.Identificator == user);
            }
            if (found == null)
            {
                ChatTab nTab = new ChatTab();
                if (type == ChatMsg.Channel)
                {
                    nTab = new ChatTab(channel, type);
                }
                else
                {
                    nTab = new ChatTab(user, type);
                }
                nTab.AddMessage(msg, user);
                tabs.TabPages.Add(nTab);
                Tabs.Add(nTab);
            }
            else
            {
                found.AddMessage(msg, user);
            }
        }
Пример #41
0
 public void SendEmoteMsg(ChatMsg Type, Languages Language, string Message, string To)
 {
     PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_TEXT_EMOTE);
     packet.Write((UInt32)Type);
     packet.Write((UInt32)Language);
     packet.Write(Message);
     Send(packet);
 }
Пример #42
0
 public void SendChatMsg(ChatMsg Type, Languages Language, string Message, string To)
 {
     PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_MESSAGECHAT);
     packet.Write((UInt32)Type);
     packet.Write((UInt32)Language);
     if ((Type == ChatMsg.CHAT_MSG_WHISPER || Type == ChatMsg.CHAT_MSG_CHANNEL) && To != "")
         packet.Write(To);
     packet.Write(Message);
     Send(packet);
 }
Пример #43
0
        public override void SendChatMessage(string text)
        {
            ChatMsg msg = new ChatMsg();
            msg.Text = text;
            msg.Author = Sync.MyId;

            OnChatMessage(ref msg);

            SendChatMessage(ref msg);    
        }
Пример #44
0
 protected override void OnChatMessage(ref ChatMsg msg)
 {
     RaiseChatMessageReceived(msg.Author, msg.Text, ChatEntryTypeEnum.ChatMsg);
 }
        public override void SendChatMessage(string text)
        {
            ChatMsg msg = new ChatMsg();
            msg.Text = text;
            msg.Author = Sync.MyId;

            SendChatMessage(ref msg);
            // This will send the message to every client except message author
            OnChatMessage(ref msg);
        }
 void OnChatMessage(ref ChatMsg msg, ulong sender)
 {
     RaiseChatMessageReceived(msg.Author, msg.Text, ChatEntryTypeEnum.ChatMsg);
 }
Пример #47
0
        public void SendEmoteMsg(ChatMsg Type, Languages Language, string Message, string To)
        {
            WoWWriter wr = new WoWWriter(OpCode.CMSG_TEXT_EMOTE);
            wr.Write((UInt32)Type);
            wr.Write((UInt32)Languages.LANG_ORCISH);
            wr.Write(Message);

            Send(wr.ToArray());
        }
        protected override void OnChatMessage(ref ChatMsg msg)
        {
            if (m_memberData.ContainsKey(msg.Author))
            {
                if (m_memberData[msg.Author].IsAdmin)
                {
                    if (msg.Text.ToLower().Contains("+unban"))
                    {
                        string[] parts = msg.Text.Split(' ');
                        if (parts.Length > 1)
                        {
                            ulong user = 0;
                            if (ulong.TryParse(parts[1], out user))
                            {
                                BanClient(user, false);
                            }
                        }
                    }
                    else if (msg.Text.ToLower() == "+reload")
                    {
                        MySandboxGame.ReloadDedicatedServerSession();
                    }
                }
            }

            RaiseChatMessageReceived(msg.Author, msg.Text, ChatEntryTypeEnum.ChatMsg);
        }
Пример #49
0
 static void HandleChatMsg(ChatMsg msg, string v1, string v2, string v3)
 {
     Log.WriteLine(LogType.Chat, "[{0}][{1}][{2}]{3}", msg, v1, v2, v3);
 }
Пример #50
0
 public void SendChatMsg(ChatMsg Type, Languages Language, string Message)
 {
     if (Type != ChatMsg.Whisper || Type != ChatMsg.Channel)
         SendChatMsg(Type, Language, Message, "");
 }
Пример #51
0
        protected override void OnChatMessage(ref ChatMsg msg)
        {
            bool debugCommands = !MyFinalBuildConstants.IS_OFFICIAL && MyFinalBuildConstants.IS_DEBUG;

            if (m_memberData.ContainsKey(msg.Author))
            {
                if (m_memberData[msg.Author].IsAdmin || debugCommands)
                {
                    if (msg.Text.Equals("+save", StringComparison.InvariantCultureIgnoreCase))
                    {
                        MySession.Static.Save();
                    }
                    else if (msg.Text.Contains("+unban", StringComparison.InvariantCultureIgnoreCase))
                    {
                        string[] parts = msg.Text.Split(' ');
                        if (parts.Length > 1)
                        {
                            ulong user = 0;
                            if (ulong.TryParse(parts[1], out user))
                            {
                                BanClient(user, false);
                            }
                        }
                    }
                }
                if(debugCommands)
                {
                    MyServerDebugCommands.Process(msg.Text, msg.Author);
                }
            }
            if(msg.Text.Contains("+43Dump"))
            {
                MySession.InitiateDump();
                return;
            }

            RaiseChatMessageReceived(msg.Author, msg.Text, ChatEntryTypeEnum.ChatMsg);
        }