Пример #1
0
        /// <summary>
        /// <para>Request full user informations from Server. Strings are ASCII and UTF8.</para>
        /// <para>Works only with ICQ-Contacts not e.g. AOL-Contacts.</para>
        /// </summary>
        /// <param name="screenname">The screenname to get information about, see <see cref="Utility.ScreennameVerifier.IsValidICQ"/></param>
        /// <remarks>Results are returned by the <see cref="FullUserInfoReceived"/> event.</remarks>
        public void RequestFullUserInfo(string screenname)
        {
            if (!ScreennameVerifier.IsValidICQ(screenname))
            {
                return;
            }

            ByteStream stream = new ByteStream();

            // Metatoken
            SSIBuddy buddy = parent.SSI.GetBuddyByName(screenname);

            byte[] metatoken = (buddy != null ? buddy.MetaInfoToken : null);

            // Length
            ushort len_token = (ushort)(metatoken != null ? metatoken.Length + 4 : 0);
            ushort len_name  = (ushort)(Encoding.ASCII.GetByteCount(screenname) + 4);

            /* * * * * User * * * * */
            stream.WriteUshort(0x0003);
            stream.WriteUint((uint)1);
            stream.WriteUshort((ushort)(len_name + len_token));         // size to end

            // MetaToken for extendet userinfo
            if (metatoken != null)
            {
                stream.WriteUshort(0x003c);
                stream.WriteUshort((ushort)metatoken.Length);
                stream.WriteByteArray(metatoken);
            }

            // TLV Block
            stream.WriteUshort(0x0032);
            stream.WriteUshort((ushort)Encoding.ASCII.GetByteCount(screenname));
            stream.WriteString(screenname, Encoding.ASCII);

            /* * * * * Header * * * * */
            SNACHeader sh = CreateIcqMetaHeader();

            stream = CreateDirectoryHeader(DirectoryRequestType.QueryInfoRequest, stream);
            stream = CreateMetaInfoHeader(parent, sh, MetaInfoRequestType.DirectoryQueryRequest, stream);

            parent.StoreRequestID(sh.RequestID, DirecotyQueryType.InfoUser);
            SNACFunctions.BuildFLAP(Marshal.BuildDataPacket(parent, sh, stream));
        }
Пример #2
0
        /// <summary>
        /// <para>Request short user informations from Server. Strings are ASCII.</para>
        /// <para>Works only with ICQ-Contacts not e.g. AOL-Contacts.</para>
        /// </summary>
        /// <param name="screenname">The screenname to get information about, see <see cref="Utility.ScreennameVerifier.IsValidICQ"/></param>
        /// <remarks>Results are returned by the <see cref="ShortUserInfoReceived"/> event</remarks>
        public void RequestShortUserInfo(string screenname)
        {
            if (!ScreennameVerifier.IsValidICQ(screenname))
            {
                return;
            }

            ByteStream stream = new ByteStream();

            stream.WriteUintLE(uint.Parse(screenname));

            /* * * * * Header * * * * */
            SNACHeader sh = CreateIcqMetaHeader();

            stream = CreateMetaInfoHeader(parent, sh, MetaInfoRequestType.ShortUserInfoRequest, stream);

            parent.StoreRequestID(sh.RequestID, screenname);
            SNACFunctions.BuildFLAP(Marshal.BuildDataPacket(parent, sh, stream));
        }