static void pidgin_media_error_cb(PidginMedia *media, const char *error, PidginMedia *gtkmedia) { PurpleConversation *conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, purple_media_get_account(gtkmedia->priv->media)); if (conv != NULL) purple_conversation_write(conv, NULL, error, PURPLE_MESSAGE_ERROR, time(NULL)); gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar), 0, error); }
gboolean purple_media_send_dtmf(PurpleMedia *media, const gchar *session_id, gchar dtmf, guint8 volume, guint16 duration) { #ifdef USE_VV PurpleAccount *account = NULL; PurpleConnection *gc = NULL; PurplePlugin *prpl = NULL; PurplePluginProtocolInfo *prpl_info = NULL; PurpleMediaBackendIface *backend_iface = NULL; if (media) { account = purple_media_get_account(media); backend_iface = PURPLE_MEDIA_BACKEND_GET_INTERFACE(media->priv->backend); } if (account) gc = purple_account_get_connection(account); if (gc) prpl = purple_connection_get_prpl(gc); if (prpl) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); if (dtmf == 'a') dtmf = 'A'; else if (dtmf == 'b') dtmf = 'B'; else if (dtmf == 'c') dtmf = 'C'; else if (dtmf == 'd') dtmf = 'D'; g_return_val_if_fail(strchr("0123456789ABCD#*", dtmf), FALSE); if (backend_iface && backend_iface->send_dtmf && backend_iface->send_dtmf(media->priv->backend, session_id, dtmf, volume, duration)) { return TRUE; } #endif return FALSE; }
static gboolean pidgin_request_timeout_cb(PidginMedia *gtkmedia) { PurpleAccount *account; PurpleBuddy *buddy; const gchar *alias; PurpleMediaSessionType type; gchar *message = NULL; account = purple_media_get_account(gtkmedia->priv->media); buddy = purple_find_buddy(account, gtkmedia->priv->screenname); alias = buddy ? purple_buddy_get_contact_alias(buddy) : gtkmedia->priv->screenname; type = gtkmedia->priv->request_type; gtkmedia->priv->timeout_id = 0; if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) { message = g_strdup_printf(_("%s wishes to start an audio/video session with you."), alias); } else if (type & PURPLE_MEDIA_AUDIO) { message = g_strdup_printf(_("%s wishes to start an audio session with you."), alias); } else if (type & PURPLE_MEDIA_VIDEO) { message = g_strdup_printf(_("%s wishes to start a video session with you."), alias); } gtkmedia->priv->request_type = PURPLE_MEDIA_NONE; if (!purple_media_accepted(gtkmedia->priv->media, NULL, NULL)) { purple_request_accept_cancel(gtkmedia, _("Incoming Call"), message, NULL, PURPLE_DEFAULT_ACTION_NONE, (void*)account, gtkmedia->priv->screenname, NULL, gtkmedia->priv->media, pidgin_media_accept_cb, pidgin_media_reject_cb); } pidgin_media_emit_message(gtkmedia, message); g_free(message); return FALSE; }
GList * purple_media_manager_get_media_by_account(PurpleMediaManager *manager, PurpleAccount *account) { #ifdef USE_VV GList *media = NULL; GList *iter; g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); iter = manager->priv->medias; for (; iter; iter = g_list_next(iter)) { if (purple_media_get_account(iter->data) == account) { media = g_list_prepend(media, iter->data); } } return media; #else return NULL; #endif }
gboolean Media::minbif_media_ready_cb(PurpleMedia *media) { Media m = media_list.getMedia(media); string alias = m.getBuddy().getAlias(); //PurpleMediaSessionType type = purple_media_get_session_type(media, sid); PurpleMediaSessionType type = PURPLE_MEDIA_VIDEO; gchar *message = NULL; PurpleAccount* account = purple_media_get_account(media); if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) { message = g_strdup_printf("%s wishes to start an audio/video session with you.", alias.c_str()); } else if (type & PURPLE_MEDIA_AUDIO) { message = g_strdup_printf("%s wishes to start an audio session with you.", alias.c_str()); } else if (type & PURPLE_MEDIA_VIDEO) { message = g_strdup_printf("%s wishes to start a video session with you.", alias.c_str()); } /* purple_request_accept_cancel is a macro and calls _() to translates * buttons strings. * There isn't (yet?) any translation system in Minbif, so the _ macro * is defined to make minbif compiles. */ #define _ purple_request_accept_cancel(media, "Incoming Call", message, NULL, PURPLE_DEFAULT_ACTION_NONE, account, alias.c_str(), NULL, media, minbif_media_accept_cb, minbif_media_reject_cb); #undef _ g_free(message); return FALSE; }