pidgin.mxit: 60960f69: MXit VV WIP.

andrew.victor at mxit.com andrew.victor at mxit.com
Sun May 15 16:45:54 EDT 2011


----------------------------------------------------------------------
Revision: 60960f69854c3b350f48451efaf9adbe770bd810
Parent:   ac8704d7f8ed3eacd5014528374f1e9e7ca522bf
Author:   andrew.victor at mxit.com
Date:     05/15/11 16:43:28
Branch:   im.pidgin.pidgin.mxit
URL: http://d.pidgin.im/viewmtn/revision/info/60960f69854c3b350f48451efaf9adbe770bd810

Changelog: 

MXit VV WIP.


Changes against parent ac8704d7f8ed3eacd5014528374f1e9e7ca522bf

  patched  libpurple/protocols/mxit/voicevideo.c

-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/voicevideo.c	859c8c0f60dfdfbb3a2be5abd4dfde7ba279d7c7
+++ libpurple/protocols/mxit/voicevideo.c	1a2a7c574cd0c2dc118c539067cc5f4622c2e844
@@ -109,6 +109,59 @@ PurpleMediaCaps mxit_media_caps(PurpleAc
 }
 
 
+static void mxit_candidates_prepared_cb(PurpleMedia* media, gchar* sessionid, gchar* who, void* session)
+{
+	purple_debug_info(MXIT_PLUGIN_ID, "mxit_candidates_prepared_cb: buddy '%s', session '%s'\n", who, sessionid);
+
+	if (purple_media_is_initiator(media, sessionid, who)) {
+		// TODO: Send INVITE via SIP.
+	}
+	else {
+		// TODO: ??
+	}
+}
+
+static void mxit_stream_info_cb(PurpleMedia* media, PurpleMediaInfoType type, char* sessionid, gchar* who, gboolean local, void* session)
+{
+	purple_debug_info(MXIT_PLUGIN_ID, "mxit_stream_info_cb: buddy '%s', session '%s', info %d \n", who, sessionid, type);
+
+	switch (type) {
+		case PURPLE_MEDIA_INFO_HANGUP:
+			break;
+		case PURPLE_MEDIA_INFO_ACCEPT:
+			break;
+		case PURPLE_MEDIA_INFO_REJECT:
+			break;
+		case PURPLE_MEDIA_INFO_MUTE:
+			break;
+		case PURPLE_MEDIA_INFO_UNMUTE:
+			break;
+		case PURPLE_MEDIA_INFO_PAUSE:
+			break;
+		case PURPLE_MEDIA_INFO_UNPAUSE:
+			break;
+		case PURPLE_MEDIA_INFO_HOLD:
+			break;
+		case PURPLE_MEDIA_INFO_UNHOLD:
+			break;
+	}
+}
+
+static void mxit_state_changed_cb(PurpleMedia* media, PurpleMediaState state, gchar* sessionid, char* who, void* session)
+{
+	purple_debug_info(MXIT_PLUGIN_ID, "mxit_state_changed_cb: buddy '%s', session '%s', state %d\n", who, sessionid, state);
+
+	switch (state) {
+		case PURPLE_MEDIA_STATE_NEW:
+			break;
+		case PURPLE_MEDIA_STATE_CONNECTED:
+			break;
+		case PURPLE_MEDIA_STATE_END:
+			break;
+	}
+}
+
+
 /*------------------------------------------------------------------------
  * Initiate a voice/video session with a contact.
  *
@@ -119,9 +172,44 @@ gboolean mxit_media_initiate(PurpleAccou
  */
 gboolean mxit_media_initiate(PurpleAccount *account, const char *who, PurpleMediaSessionType type)
 {
+	gchar* transmitter = "rawudp";
+	PurpleMedia* media = NULL;
+
 	purple_debug_info(MXIT_PLUGIN_ID, "mxit_media_initiate: buddy '%s'\n", who);
 
-	return FALSE;
+	media = purple_media_manager_create_media(
+		purple_media_manager_get(),
+		account,
+		"fsrtpconference",
+		who,
+		TRUE
+	);
+
+	if (!media) {
+		purple_debug_info(MXIT_PLUGIN_ID, "mxit_media_initiate: could not create media session\n");
+		return FALSE;
+	}
+
+	/* attach callbacks */
+	g_signal_connect(G_OBJECT(media), "candidates-prepared", G_CALLBACK(mxit_candidates_prepared_cb), NULL);
+	g_signal_connect(G_OBJECT(media), "stream-info", G_CALLBACK(mxit_stream_info_cb), NULL);
+	g_signal_connect(G_OBJECT(media), "state-changed", G_CALLBACK(mxit_state_changed_cb), NULL);
+
+	/* initiate audio session */
+	if ((type & PURPLE_MEDIA_AUDIO) && 
+			(!purple_media_add_stream(media, "audio", who, PURPLE_MEDIA_AUDIO, TRUE, transmitter, 0, NULL))) {
+		purple_media_end(media, NULL, NULL);
+		return FALSE;
+	}
+
+	/* initiate video session */
+	if ((type & PURPLE_MEDIA_VIDEO) &&
+			(!purple_media_add_stream(media, "video", who, PURPLE_MEDIA_VIDEO, TRUE, transmitter, 0, NULL))) {
+		purple_media_end(media, NULL, NULL);
+		return FALSE;
+	}
+
+	return TRUE;
 }
 
 #else


More information about the Commits mailing list