/// <summary> /// Set my icq contact informations. /// </summary> /// <param name="ui">My Details</param> /// <remarks> /// <para>The following properties can't be set:</para> /// <para><seealso cref="FullUserInfo.Screenname"/>, <seealso cref="FullUserInfo.Email"/> (use <seealso cref="SendUserEmail"/> instead), <seealso cref="FullUserInfo.Age"/>, <seealso cref="FullUserInfo.CodePage"/>, /// <seealso cref="FullUserInfo.Timezone"/></para> /// </remarks> public void SendUserInfo(FullUserInfo ui) { TlvBlock tlvs = new TlvBlock(); // Names tlvs.WriteString(0x64, ui.Firstname, Encoding.UTF8); tlvs.WriteString(0x6e, ui.Lastname, Encoding.UTF8); tlvs.WriteString(0x78, ui.Nickname, Encoding.UTF8); // Home Address tlvs.WriteByteArray(0x96, ProcessDirectoryUpdateRequestUserDetails(0x96, ui)); // Origin Address tlvs.WriteByteArray(0xa0, ProcessDirectoryUpdateRequestUserDetails(0xa0, ui)); // Phone Numbers tlvs.WriteByteArray(0xc8, ProcessDirectoryUpdateRequestUserDetails(0xc8, ui)); // Emails tlvs.WriteByteArray(0x8c, ProcessDirectoryUpdateRequestUserDetails(0x8c, ui)); // Work tlvs.WriteByteArray(0x118, ProcessDirectoryUpdateRequestUserDetails(0x118, ui)); // Education tlvs.WriteByteArray(0x10e, ProcessDirectoryUpdateRequestUserDetails(0x10e, ui)); // Interests tlvs.WriteByteArray(0x122, ProcessDirectoryUpdateRequestUserDetails(0x122, ui)); // Timezone TimeSpan ts = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); if (TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now)) { ts -= TimeZone.CurrentTimeZone.GetDaylightChanges(DateTime.Now.Year).Delta; } tlvs.WriteSshort(0x17c, (short)(ts.TotalMinutes / -30)); switch (ui.Gender.ToString().ToUpper()) { case "F": tlvs.WriteByte(0x82, 1); break; case "M": tlvs.WriteByte(0x82, 2); break; default: tlvs.WriteByte(0x82, 0); break; } tlvs.WriteString(0xfa, ui.Website, Encoding.ASCII); if (ui.Birthday == DateTime.MinValue) { tlvs.WriteDouble(0x1a4, 0); } else { tlvs.WriteDouble(0x1a4, ui.Birthday.ToOADate() - 2); } tlvs.WriteUshort(0xaa, (ushort)ui.Language1); tlvs.WriteUshort(0xb4, (ushort)ui.Language2); tlvs.WriteUshort(0xbe, (ushort)ui.Language3); tlvs.WriteUshort(0x12c, (ushort)ui.MaritalStatus); tlvs.WriteString(0x186, ui.About, Encoding.UTF8); tlvs.WriteString(0x226, ui.StatusNote, Encoding.UTF8); tlvs.WriteUshort(0x1f9, ui.PrivacyLevel); tlvs.WriteUshort(0x19a, ui.Auth); tlvs.WriteByte(0x212, ui.WebAware); tlvs.WriteByte(0x1ea, ui.AllowSpam); tlvs.WriteUshort(0x1c2, (ushort)Encoding.Default.CodePage); //ui.CodePage ByteStream stream = new ByteStream(); stream.WriteUshort(0x0003); stream.WriteUshort((ushort)tlvs.GetByteCount()); stream.WriteByteArray(tlvs.GetBytes()); /* * * * * Header * * * * */ SNACHeader sh = CreateIcqMetaHeader(); stream = CreateDirectoryHeader(DirectoryRequestType.SetInfoRequest, stream); stream = CreateMetaInfoHeader(parent, sh, MetaInfoRequestType.DirectoryUpdateRequest, stream); //parent.StoreRequestID(sh.RequestID, DirecotyQueryType.InfoUser); SNACFunctions.BuildFLAP(Marshal.BuildDataPacket(parent, sh, stream)); }