<commit_before>/*
 * Created on 20/10/2003
 */
package net.java.sip.communicator.impl.protocol.icq.message.usrinfo;

import java.io.*;

import net.java.sip.communicator.impl.protocol.icq.message.common.*;
import net.kano.joscar.*;
import net.kano.joscar.flapcmd.*;
import net.java.sip.communicator.util.Logger;

/**
 * @author jkohen
 */
public class MetaShortInfoCmd
    extends SnacCommand
{
    private static final Logger logger =
        Logger.getLogger(MetaShortInfoCmd.class);

    private static final int NDX_NICKNAME = 0;
    private static final int NDX_FNAME = 1;
    private static final int NDX_LNAME = 2;
    private static final int NDX_EMAIL = 3;

    private String[] s = new String[4];

    public MetaShortInfoCmd(FromIcqCmd packet)
    {
        super(21, 3);

        ByteBlock block = packet.getIcqData();
        logger.info("received response ---- ");
        // Byte 0: unknown
        int offset = 1;
        for (int i = 0; i < s.length; i++)
        {
            final int textlen = LEBinaryTools.getUShort(block, offset) - 1; // Don't include the ending NUL.
            offset += 2;

            if (textlen > 0)
            {
                ByteBlock field = block.subBlock(offset, textlen);
                s[i] = OscarTools.getString(field, "US-ASCII");
                offset += textlen;
            }
            logger.info("----- " + s[i]);
            offset++; // Skip trailing NUL.
        }
    }

    /**
     * Returns the nick name of the user whose information is represented here,
     * or <code>null</code> if none was given.
     *<commit_msg>MessageHistory Tests<commit_after>/*
 * Created on 20/10/2003
 */
package net.java.sip.communicator.impl.protocol.icq.message.usrinfo;

import java.io.*;

import net.java.sip.communicator.impl.protocol.icq.message.common.*;
import net.kano.joscar.*;
import net.kano.joscar.flapcmd.*;

/**
 * @author jkohen
 */
public class MetaShortInfoCmd
    extends SnacCommand
{
    private static final int NDX_NICKNAME = 0;
    private static final int NDX_FNAME = 1;
    private static final int NDX_LNAME = 2;
    private static final int NDX_EMAIL = 3;

    private String[] s = new String[4];

    public MetaShortInfoCmd(FromIcqCmd packet)
    {
        super(21, 3);

        ByteBlock block = packet.getIcqData();

        // Byte 0: unknown
        int offset = 1;
        for (int i = 0; i < s.length; i++)
        {
            final int textlen = LEBinaryTools.getUShort(block, offset) - 1; // Don't include the ending NUL.
            offset += 2;

            if (textlen > 0)
            {
                ByteBlock field = block.subBlock(offset, textlen);
                s[i] = OscarTools.getString(field, "US-ASCII");
                offset += textlen;
            }

            offset++; // Skip trailing NUL.
        }
    }

    /**
     * Returns the nick name of the user whose information is represented here,
     * or <code>null</code> if none was given.
     *
{'fraction_non_alphanumeric': 0.11570803901782711, 'fraction_numerical': 0.014799865455768583, 'mean_word_length': 2.0914760914760913, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6003967', 'n_tokens_mistral': 968, 'n_tokens_neox': 901, 'n_words': 249}