Ejemplo n.º 1
0
void
msn_slp_call_init(MsnSlpCall *slpcall, MsnSlpCallType type)
{
	slpcall->session_id = rand() % 0xFFFFFF00 + 4;
	slpcall->id = rand_guid();
	slpcall->type = type;
}
Ejemplo n.º 2
0
MsnSession *
msn_session_new(PurpleAccount *account)
{
	MsnSession *session;

	g_return_val_if_fail(account != NULL, NULL);

	session = g_new0(MsnSession, 1);

	session->http_reqs = purple_http_connection_set_new();

	session->account = account;
	session->notification = msn_notification_new(session);
	session->userlist = msn_userlist_new(session);

	session->user = msn_user_new(session->userlist,
								 purple_account_get_username(account), NULL);
	msn_userlist_add_user(session->userlist, session->user);
	session->oim = msn_oim_new(session);

	session->protocol_ver = 0;
	session->enable_mpop = TRUE; /* Default only */

	session->guid = rand_guid();

	session->soap = msn_soap_service_new(session);

	return session;
}
Ejemplo n.º 3
0
/*new a OIM object*/
MsnOim *
msn_oim_new(MsnSession *session)
{
	MsnOim *oim;

	oim = g_new0(MsnOim, 1);
	oim->session = session;
	oim->oim_list = NULL;
	oim->run_id = rand_guid();
	oim->challenge = NULL;
	oim->send_queue = g_queue_new();
	oim->send_seq = 1;
	return oim;
}
Ejemplo n.º 4
0
static void
init_plugin(PurplePlugin *plugin)
{
    purple_debug_warning("np","\n=== START LOG ==\n");
    
    PurpleAccountOption *option;

    option = purple_account_option_string_new(_("Server"), "server",
                                              NP_IM_SERVER);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
											   option);
    
	option = purple_account_option_int_new(_("Port"), "port", NP_IM_PORT);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
											   option);
    
	option = purple_account_option_string_new(_("HTTP Method Server"),
                                              "http_method_server", NP_HTTPCONN_SERVER);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
											   option);
    // User-Agent
    option = purple_account_option_string_new(_("User-Agent"),
                                              "np_user_agent", NP_USER_AGENT);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
											   option);
    
    // Device Id
    char *device_id =rand_guid();
    option = purple_account_option_string_new(_("Device-ID"),
                                              "deivce_id", device_id);
    g_free(device_id);
    
    option = purple_account_option_bool_new(_("Allow direct connections"),
                                            "direct_connect", TRUE);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
											   option);
    
	option = purple_account_option_bool_new(_("Allow connecting from multiple locations"),
                                            "mpop", TRUE);
	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
											   option);
    
    purple_prefs_remove("/plugins/prpl/np");

}
Ejemplo n.º 5
0
void
msn_slp_call_invite(MsnSlpCall *slpcall, const char *euf_guid,
					int app_id, const char *context)
{
	MsnSlpLink *slplink;
	MsnSlpMessage *slpmsg;
	char *header;
	char *content;

	g_return_if_fail(slpcall != NULL);
	g_return_if_fail(context != NULL);

	slplink = slpcall->slplink;

	slpcall->branch = rand_guid();

	content = g_strdup_printf(
		"EUF-GUID: {%s}\r\n"
		"SessionID: %lu\r\n"
		"AppID: %d\r\n"
		"Context: %s\r\n\r\n",
		euf_guid,
		slpcall->session_id,
		app_id,
		context);

	header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0",
							 slplink->remote_user);

	slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, slpcall->branch,
								"application/x-msnmsgr-sessionreqbody", content);

#ifdef MSN_DEBUG_SLP
	slpmsg->info = "SLP INVITE";
	slpmsg->text_body = TRUE;
#endif

	msn_slplink_send_slpmsg(slplink, slpmsg);

	g_free(header);
	g_free(content);
}
Ejemplo n.º 6
0
/** Invite us to the focus */
void
sipe_invite_conf_focus(struct sipe_core_private *sipe_private,
		       struct sip_session *session)
{
	gchar *hdr;
	gchar *contact;
	gchar *body;
	gchar *self;

	if (session->focus_dialog && session->focus_dialog->is_established) {
		SIPE_DEBUG_INFO("session with %s already has a dialog open", session->focus_uri);
		return;
	}

	if(!session->focus_dialog) {
		session->focus_dialog = g_new0(struct sip_dialog, 1);
		session->focus_dialog->callid = gencallid();
		session->focus_dialog->with = g_strdup(session->focus_uri);
		session->focus_dialog->endpoint_GUID = rand_guid();
	}
Ejemplo n.º 7
0
/** Create new session with Focus URI */
struct sip_session *
sipe_conf_create(struct sipe_core_private *sipe_private,
		 struct sipe_chat_session *chat_session,
		 const gchar *focus_uri)
{
	gchar *hdr;
	gchar *contact;
	gchar *body;
	gchar *self;
	struct sip_session *session = sipe_session_add_chat(sipe_private,
							    chat_session,
							    FALSE,
							    focus_uri);

	session->focus_dialog = g_new0(struct sip_dialog, 1);
	session->focus_dialog->callid = gencallid();
	session->focus_dialog->with = g_strdup(session->chat_session->id);
	session->focus_dialog->endpoint_GUID = rand_guid();
	session->focus_dialog->ourtag = gentag();

	contact = get_contact(sipe_private);
	hdr = g_strdup_printf(
		"Supported: ms-sender\r\n"
		"Contact: %s\r\n"
		"Content-Type: application/cccp+xml\r\n",
		contact);
	g_free(contact);

	/* @TODO put request_id to queue to further compare with incoming one */
	/* focus_URI, from, request_id, focus_URI, from, endpoint_GUID */
	self = sip_uri_self(sipe_private);
	body = g_strdup_printf(
		SIPE_SEND_CONF_ADD_USER,
		session->focus_dialog->with,
		self,
		session->request_id++,
		session->focus_dialog->with,
		self,
		session->focus_dialog->endpoint_GUID);

	session->focus_dialog->outgoing_invite =
		sip_transport_invite(sipe_private,
				     hdr,
				     body,
				     session->focus_dialog,
				     process_invite_conf_focus_response);
	g_free(body);
	g_free(hdr);

	/* Rejoin existing session? */
	if (chat_session) {
		SIPE_DEBUG_INFO("sipe_conf_create: rejoin '%s' (%s)",
				chat_session->title,
				chat_session->id);
		sipe_backend_chat_rejoin(SIPE_CORE_PUBLIC,
					 chat_session->backend,
					 self,
					 chat_session->title);
	}
	g_free(self);

	return(session);
}