[icq-devel] Status flags

Remy Lebeau gambit47 at yahoo.com
Sat Jun 28 06:20:17 CEST 2003

--- Andrew Lytle <alytle at cogeco.ca> wrote:

> Basically what I want to do is take the info
> from the SNAC (0x03, 0x0B):
> TLV(06): User Status DWORD and figure out
> how I'm supposed to interpret the data.

Have a look at the information from the following
page, works pretty well:

User status 

Below is a snippet of code I use in my own C++ project
to translate the status values into human-readible
strings for display (Note: just ignore the custom
classes I wrote for parsing the raw socket data.  You
should get the general jist of it):

#define TLV_STATUS          0x0006

#define STATUSF_WEBAWARE    0x0001
#define STATUSF_SHOWIP      0x0002
#define STATUSF_BIRTH       0x0008
#define STATUSF_UNK         0x0010
#define STATUSF_WEBFRONT    0x0020
#define STATUSF_DCDISABLED  0x0100
#define STATUSF_DCAUTH      0x1000
#define STATUSF_DCCONTACT   0x2000

#define STATUS_ONLINE       0x0000
#define STATUS_AWAY         0x0001
#define STATUS_DND          0x0002
#define STATUS_NA           0x0004
#define STATUS_OCCUPIED     0x0010
#define STATUS_FFC          0x0020
#define STATUS_INVISIBLE    0x0100


switch( tlv.type )
    case TLV_STATUS:
        TIMString flags =
        TIMString status =

typedef struct
    IM_USHORT flag;
    IM_STRING desc;
} FlagDesc;

IM_STRING StatusFlagsToString(IM_USHORT flags)
    static const FlagDesc arr[] = {
        {STATUSF_WEBAWARE, "Web Aware"},
        {STATUSF_SHOWIP, "Show IP"},
        {STATUSF_BIRTH, "Birthday"},
        {STATUSF_UNK, "Unknown"},
        {STATUSF_WEBFRONT, "Web Front"},
        {STATUSF_DCDISABLED, "DC Disabled"},
        {STATUSF_DCAUTH, "DC Upon Auth"},
        {STATUSF_DCCONTACT, "DC w/ Contacts"}
    static const FlagDescCount =
    static IMDataManager dm;


    for(IM_BYTE b = 0; b < FlagDescCount; ++b)
        if( flags & arr[b].flag )
            if( dm.pos != 0 )
                dm.WriteRaw(", ", 2);

    return (IM_STRING)dm.data;

typedef struct
    IM_USHORT status;
    IM_STRING desc;
} StatusDesc;

IM_STRING StatusToString(IM_USHORT status)
    static const StatusDesc arr[] = {
        {STATUS_OFFLINE, "Offline"},
        {STATUS_ONLINE, "Online"},
        {STATUS_AWAY, "Away"},
        {STATUS_DND, "DND"},
        {STATUS_NA, "NA"},
        {STATUS_OCCUPIED, "Occupied"},
        {STATUS_FFC, "Free for Chat"},
        {STATUS_INVISIBLE, "Invisible"}
    static const StatusDescCount =

    for(IM_BYTE b = 0; b < StatusDescCount; ++b)
        if( status == arr[b].status )
            return arr[b].desc;

    return NULL;


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

More information about the icq-devel mailing list