예제 #1
0
void cmd_open ( const char *mission_name )
{
	if ( mission_name == NULL )
		mission_name = "trainingmission";

	if ( strlen ( mission_name ) != 36 ) /* not an uuid */
	{
		struct mission *m = mission_list_get ( mission_name );

		if ( m != NULL )
		{
			int is_pvp = strstr ( m->mode, "pvp" ) != NULL;
			int were_in_pvp = strstr ( session.online.channel, "pvp" ) != NULL;

			if ( is_pvp && !were_in_pvp )
				xmpp_iq_join_channel ( "pvp_pro_5", NULL, NULL );
			else if ( !is_pvp && were_in_pvp )
				xmpp_iq_join_channel ( "pve_2", NULL, NULL );

			if ( is_pvp )
				xmpp_iq_gameroom_open ( m->mission_key, ROOM_PVP_PUBLIC, NULL, NULL );
			else
				xmpp_iq_gameroom_open ( m->mission_key, ROOM_PVE_PRIVATE, NULL, NULL );
		}
		else
		{
			LOGPRINT ( KRED "NO SUCH MAP OR MISSION\n" );
		}
	}
	else
	{
		xmpp_iq_gameroom_open ( mission_name, ROOM_PVE_PRIVATE, NULL, NULL );
	}
}
예제 #2
0
void xmpp_iq_gameroom_join(const char *channel, const char *room_id)
{
    struct cb_args *a = calloc(1, sizeof (struct cb_args));
    a->channel = strdup(channel);
    a->room_id = strdup(room_id);

    /* Change channel if room is not on the same server */
    if (strcmp(session.channel, channel))
        xmpp_iq_join_channel(channel, xmpp_iq_gameroom_join_, a);
    else
        xmpp_iq_gameroom_join_(a);
}
예제 #3
0
void quickplay_open(const char *mission_key,
                    enum e_room_type type,
                    const char *game_mode,
                    f_join_channel_cb cb,
                    void *args)
{
    if (session.quickplay.uid != NULL)
    {
        eprintf("There is already a quickplay request in progress\n");
        return;
    }

    /* Generate new UID */
    session.quickplay.pre_uid = new_random_uuid();

    session.quickplay.type = type;
    session.quickplay.channel_switches = 1;

    if (mission_key != NULL)
        session.quickplay.mission_id = strdup(mission_key);
    if (game_mode != NULL)
        session.quickplay.game_mode = strdup(game_mode);

    int is_pve = type & ROOM_PVE_QUICKPLAY;
    int were_in_pve =
        strstr(session.online.channel_type, "pve") != NULL;

    if (is_pve == were_in_pve)
    {
        if (cb)
            cb(args);
    }
    else
    {
        const char *ms_type = (is_pve) ? "pve" : "pvp_pro";

        struct masterserver *ms =
            masterserver_list_get_by_type(ms_type);

        if (ms != NULL)
        {
            xmpp_iq_join_channel(ms->resource, cb, args);
        }
        else
        {
            eprintf("No channel of type '%s' found\n",
                    ms_type);
        }
    }
}
static void xmpp_iq_get_account_profiles_cb(const char *msg, void *args)
{
    /* Answer :
       <iq from="masterserver@warface/pve_12" type="result">
         <query xmlns="urn:cryonline:k01">
           <get_account_profiles>
             <profile id="XXX" nickname="XXX"/>
           </get_account_profiles>
         </query>
       </iq>
    */

    session.profile_id = get_info(msg, "profile id='", "'", "PROFILE ID");
    session.nickname = get_info(msg, "nickname='", "'", "NICKNAME");

    if (!session.profile_id)
        xmpp_iq_create_profile();
    else
        xmpp_iq_join_channel(NULL);
}
예제 #5
0
void cmd_channel ( const char *channel )
{
	xmpp_iq_join_channel ( channel, NULL, NULL );
}