GuildChatMsg() public static method

Sends GuildChatMsg from sender to user's client.
public static GuildChatMsg ( Aura.Msgr.Database.User user, string sender, string msg ) : void
user Aura.Msgr.Database.User
sender string
msg string
return void
Exemplo n.º 1
0
        public void GuildChat(MsgrClient client, Packet packet)
        {
            var msg = packet.GetString();

            var guild = MsgrServer.Instance.GuildManager.FindGuildWithMember(client.User.CharacterId);

            if (guild == null)
            {
                // Don't warn, the client will probably allow this before
                // the msgr server caught up.
                return;
            }

            GuildManager.ForOnlineMembers(guild, user => Send.GuildChatMsg(user, client.User.Name, msg));
        }
Exemplo n.º 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);
        }