ChatBeginR() public static method

Notifies users about friend being offline.
public static ChatBeginR ( Aura.Msgr.Database.User user, long sessionId, int friendId ) : void
user Aura.Msgr.Database.User
sessionId long
friendId int
return void
コード例 #1
0
ファイル: MsgrHandlers.cs プロジェクト: anjhony6778/aura
        public void ChatBegin(MsgrClient client, Packet packet)
        {
            var contactId = packet.GetInt();
            var unkByte   = packet.GetByte();

            // Check friend and relation
            var friend = client.User.GetFriend(contactId);

            if (friend == null || friend.FriendshipStatus != FriendshipStatus.Normal)
            {
                Log.Warning("ChatBegin: User '{0}' tried to start chat without being friends.", client.User.AccountId);
                return;
            }

            // Check if online
            var user = MsgrServer.Instance.UserManager.Get(contactId);

            if (user == null)
            {
                Log.Warning("ChatBegin: User '{0}' tried to start chat with offline friend.", client.User.AccountId);
                return;
            }

            ChatSession session;

            // Get or create session
            session = MsgrServer.Instance.ChatSessionManager.Find(client.User.Id, friend.Id);
            if (session == null)
            {
                session = new ChatSession();
            }

            session.Join(client.User);
            session.Add(user);

            Send.ChatBeginR(client.User, session.Id, contactId);
        }
コード例 #2
0
        public void ChatBegin(MsgrClient client, Packet packet)
        {
            var contactId = packet.GetInt();
            var list      = packet.GetByte();        // 0=friends, 1=guild

            // Disable guild msgr for now. For some reason the contact can't
            // properly accept the chat, which causes weird behavior.
            // Since the guild msgr is technically a G4 feature we can
            // technically get away with that, but we should figure it out
            // some time.
            if (list == 1)
            {
                Send.GuildChatMsg(client.User, Localization.Get("<SERVER>"), Localization.Get("This feature hasn't been implemented yet."));
                return;
            }

            // Check if online
            var user = MsgrServer.Instance.UserManager.Get(contactId);

            if (user == null)
            {
                Log.Warning("ChatBegin: User '{0}' tried to start chat with offline friend.", client.User.AccountId);
                return;
            }

            //if (list == 0)
            {
                // Check friend and relation
                var friend = client.User.GetFriend(contactId);
                if (friend == null || friend.FriendshipStatus != FriendshipStatus.Normal)
                {
                    Log.Warning("ChatBegin: User '{0}' tried to start chat without being friends.", client.User.AccountId);
                    return;
                }
            }
            //else
            //{
            //	// Check guild
            //	var guild = MsgrServer.Instance.GuildManager.FindGuildWithMember(client.User.CharacterId);
            //	var userGuild = MsgrServer.Instance.GuildManager.FindGuildWithMember(user.CharacterId);

            //	if (guild == null || guild != userGuild)
            //	{
            //		Log.Warning("ChatBegin: User '{0}' tried to start chat without being in the same guild.", client.User.AccountId);
            //		return;
            //	}
            //}

            ChatSession session;

            // Get or create session
            session = MsgrServer.Instance.ChatSessionManager.Find(client.User.Id, user.Id);
            if (session == null)
            {
                session = new ChatSession();
            }

            session.Join(client.User);
            session.Add(user);

            Send.ChatBeginR(client.User, session.Id, contactId);
        }