private void sess_UserInfoReceived(object sender, UserInfoResponse info) { Console.WriteLine("Got extended info for " + info.Info.ScreenName); if (info.Info.Icon != null) { //Console.WriteLine("Got valid icon info for " + info.Info.ScreenName); } }
/// <summary> /// Processes user information sent by the server -- SNAC(02,06) /// </summary> /// <param name="dp">A <see cref="DataPacket"/> object with a buffer containing SNAC(02,06)</param> private void ProcessUserInfo(DataPacket dp) { if (dp.SNAC.Flags != 0) { Logging.DumpFLAP(dp.Data.GetBytes(), "You've got to be s******g me"); } // Apparently, the userinfo block will always be first, // and then possibly TLVs 0x0001 - 0x0005, depending on the request byte[] awaymessage = null; Encoding awaymessageencoding = Encoding.ASCII; byte[] profile = null; Encoding profileencoding = Encoding.ASCII; Capabilities caps = Capabilities.None; UserInfo ui = dp.Data.ReadUserInfo(); using (TlvBlock tlvs = new TlvBlock(dp.Data.ReadByteArrayToEnd())) { profileencoding = Marshal.AolMimeToEncoding(tlvs.ReadString(LOCATION_PROFILE_ENCODING, Encoding.ASCII)); profile = tlvs.ReadByteArray(LOCATION_PROFILE); awaymessageencoding = Marshal.AolMimeToEncoding(tlvs.ReadString(LOCATION_AWAYMESSAGE_ENCODING, Encoding.ASCII)); awaymessage = tlvs.ReadByteArray(LOCATION_AWAYMESSAGE); caps = CapabilityProcessor.ProcessCLSIDList(tlvs.ReadByteArray(LOCATION_CAPABILITIES)); } UserInfoResponse uir = new UserInfoResponse(); uir.Info = ui; if (profile != null) { uir.Profile = profileencoding.GetString(profile, 0, profile.Length); uir.ProfileEncoding = profileencoding; } if (awaymessage != null) { uir.AwayMessage = awaymessageencoding.GetString(awaymessage, 0, awaymessage.Length); uir.AwayMessageEncoding = awaymessageencoding; } uir.ClientCapabilities = caps; if (UserInfoReceived != null) { UserInfoReceived(this, uir); } }