示例#1
0
    private void AddFollow(int connectionId, int channelId, int recievingHostId, Net_AddFollow msg)
    {
        Net_OnAddFollow rmsg = new Net_OnAddFollow();

        if (db.InsertFollow(msg.Token, msg.UsernameDiscriminatorOrEmail))
        {
            if (Utility.IsEmail(msg.UsernameDiscriminatorOrEmail))
            {
                // this is email
                rmsg.Follow = db.FindAccountByEmail(msg.UsernameDiscriminatorOrEmail).GetAccount();
            }
            else
            {
                // this is username
                string[] data = msg.UsernameDiscriminatorOrEmail.Split('#');
                if (data[1] == null)
                {
                    return;
                }

                rmsg.Follow = db.FindAccountByUsernameAndDiscriminator(data[0], data[1]).GetAccount();
            }
        }

        SendClient(recievingHostId, connectionId, rmsg);
    }