Esempio n. 1
0
/**
 * Process notification routine.
 */
static void
process_notify_cb(fetion_account *ac, const gchar *sipmsg)
{
    gint notify_type;
    gint event_type;

    sip_parse_notify(sipmsg, &notify_type, &event_type);

    if (notify_type == NOTIFICATION_TYPE_UNKNOWN ||
            event_type == NOTIFICATION_EVENT_UNKNOWN) {

        hybrid_debug_info("fetion", "recv unknown notification:\n%s", sipmsg);
        return;
    }

    switch (notify_type) {

        case NOTIFICATION_TYPE_PRESENCE:
            if (event_type == NOTIFICATION_EVENT_PRESENCECHANGED) {
                process_presence(ac, sipmsg);
            }
            break;

        case NOTIFICATION_TYPE_CONVERSATION :
            if (event_type == NOTIFICATION_EVENT_USERLEFT) {
                process_left_cb(ac, sipmsg);
                break;

            } else     if (event_type == NOTIFICATION_EVENT_USERENTER) {
                process_enter_cb(ac, sipmsg);
                break;
            }
            break;

        case NOTIFICATION_TYPE_REGISTRATION :
            if (event_type == NOTIFICATION_EVENT_DEREGISTRATION) {
                process_dereg_cb(ac, sipmsg);
            }
            break;

        case NOTIFICATION_TYPE_SYNCUSERINFO :
            if (event_type == NOTIFICATION_EVENT_SYNCUSERINFO) {
                process_sync_info(ac, sipmsg);
            }
            break;

        case NOTIFICATION_TYPE_CONTACT :
            if (event_type == NOTIFICATION_EVENT_ADDBUDDYAPPLICATION) {
                process_add_buddy(ac, sipmsg);
            }
            break;
#if 0
        case NOTIFICATION_TYPE_PGGROUP :
            break;
#endif
        default:
            break;
    }
}
Esempio n. 2
0
// process stanza - this is one of the most important functions.
// This function looks at what kind of stanza was just recieved.
// and sends the stanza to the function that deals with that kind of stanza.
// There are three kinds of stanza message, iq, and presence. 
void ProcessStanza::process_stanza(XMPP::Stanza s, const char* fromJID) {
	// if the stanza is a message
	if (strcmp(s.kindString(),"message") == 0) {
		process_message(s,fromJID);
	}
	// if the stanza is iq information
	else if (strcmp(s.kindString(),"iq") == 0) {
		process_iq(s,fromJID);
	}
	//if the stanza is presence information
	else if (strcmp(s.kindString(),"presence") == 0) {
		process_presence(s,fromJID);
	}
}
Esempio n. 3
0
static void process_notify_cb(fetion_account *ac, const gchar *sipmsg)
{
	gint   event;
	gint   notification_type;
	gchar  *xml;

	fetion_sip_parse_notification(sipmsg , &notification_type , &event , &xml);

	switch(notification_type) {
		case NOTIFICATION_TYPE_PRESENCE:
			if(event == NOTIFICATION_EVENT_PRESENCECHANGED)	process_presence(ac , xml);
			break;
		case NOTIFICATION_TYPE_CONVERSATION :
			if(event == NOTIFICATION_EVENT_USERLEFT) {
				process_left_cb(ac, sipmsg);
				break;
			} else 	if(event == NOTIFICATION_EVENT_USERENTER) {
				process_enter_cb(ac, sipmsg);
				break;
			}
			break;
		case NOTIFICATION_TYPE_REGISTRATION :
			if(event == NOTIFICATION_EVENT_DEREGISTRATION)	process_dereg_cb(ac, sipmsg);
			break;
		case NOTIFICATION_TYPE_SYNCUSERINFO :
			if(event == NOTIFICATION_EVENT_SYNCUSERINFO)	process_sync_info(ac, sipmsg);
			break;
		case NOTIFICATION_TYPE_CONTACT :
			if(event == NOTIFICATION_EVENT_ADDBUDDYAPPLICATION)	process_add_buddy(ac, sipmsg);
			break;
#if 0
		case NOTIFICATION_TYPE_PGGROUP :
			break;
#endif
		default:
			break;
	}
	g_free(xml);
}