Esempio n. 1
0
void
client_actions(int fd){

    char *tag;

    tag=xmlgetfirsttagname(client[fd].buffer);

    switch (client[fd].state) {

        case STREAM: {
            /* setup a new stream */
            printf("STREAM\n");          
            stream(fd);
        } break;

        case LOGIN: {
            /* perform login procedures */
            printf("LOGIN\n");          

            if (!strcmp(tag,"iq"))
                client_login(fd);
            else
                unknown_msg(fd);

        } break;

        case CHAT: {
            printf("CHAT\n");          

            if (!strcmp(tag,"iq"))
                iq(fd);
            else if (!strcmp(tag,"presence"))
                presence(fd);
            else if (!strcmp(tag,"message"))
                message(fd);
            else
                unknown_msg(fd);
        } break;

    } /* end case */

    free(tag);
    
} /* end client actions */
/**
 * get_cat_table_entry_short_name - translate entry id to short name
 * @category: category to look up (enum ih_category)
 * @id: entry id to be translated
 *
 * This will scan the translation table trying to find the entry that matches
 * the given id.
 *
 * @retur short entry name if translation succeeds; error string on failure
 */
const char *genimg_get_cat_short_name(enum ih_category category, uint id)
{
	const table_entry_t *entry;

	entry = get_table_entry(table_info[category].table, id);
	if (!entry)
		return unknown_msg(category);
#if defined(USE_HOSTCC) || !defined(CONFIG_NEEDS_MANUAL_RELOC)
	return entry->sname;
#else
	return entry->sname + gd->reloc_off;
#endif
}