/// <summary> /// Sets the away message and/or profile of the client /// </summary> /// <param name="awayMessage">The away message to set</param> /// <param name="profile">The profile to set</param> private void SetAwayMessageProfileInternal(string awayMessage, string profile) { // Build the SNAC header SNACHeader sh = new SNACHeader(); sh.FamilyServiceID = SNAC_LOCATION_FAMILY; sh.FamilySubtypeID = LOCATION_PARAMETER_USERINFO; ByteStream stream = new ByteStream(); using (TlvBlock tlvs = new TlvBlock()) { if (profile != null) { Encoding profileEncoding = UtilityMethods.FindBestOscarEncoding(profile); tlvs.WriteString(LOCATION_PROFILE_ENCODING, Marshal.EncodingToAolMime(profileEncoding), Encoding.ASCII); tlvs.WriteString(LOCATION_PROFILE, profile, profileEncoding); } if (awayMessage != null) { Encoding awayMessageEncoding = UtilityMethods.FindBestOscarEncoding(awayMessage); tlvs.WriteString(LOCATION_AWAYMESSAGE_ENCODING, Marshal.EncodingToAolMime(awayMessageEncoding), Encoding.ASCII); tlvs.WriteString(LOCATION_AWAYMESSAGE, awayMessage, awayMessageEncoding); } stream.WriteByteArray(tlvs.GetBytes()); } SNACFunctions.BuildFLAP(Marshal.BuildDataPacket(parent, sh, stream)); }