Mercurial > pidgin
changeset 26123:75a02ffb0139
Added purple_media_manager_get_media_by_connection.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Wed, 25 Feb 2009 03:28:27 +0000 |
parents | e411aad4346b |
children | f10034e0321b |
files | libpurple/mediamanager.c libpurple/mediamanager.h |
diffstat | 2 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/mediamanager.c Wed Feb 25 02:40:10 2009 +0000 +++ b/libpurple/mediamanager.c Wed Feb 25 03:28:27 2009 +0000 @@ -273,6 +273,25 @@ return manager->priv->medias; } +GList * +purple_media_manager_get_media_by_connection(PurpleMediaManager *manager, + PurpleConnection *pc) +{ + 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_connection(iter->data) == pc) { + media = g_list_prepend(media, iter->data); + } + } + + return media; +} + void purple_media_manager_remove_media(PurpleMediaManager *manager, PurpleMedia *media)
--- a/libpurple/mediamanager.h Wed Feb 25 02:40:10 2009 +0000 +++ b/libpurple/mediamanager.h Wed Feb 25 03:28:27 2009 +0000 @@ -156,6 +156,17 @@ GList *purple_media_manager_get_media(PurpleMediaManager *manager); /** + * Gets all of the media sessions for a given connection. + * + * @param manager The media manager to get the sessions from. + * @param pc The connection the sessions are on. + * + * @return A list of the media sessions on the given connection. + */ +GList *purple_media_manager_get_media_by_connection( + PurpleMediaManager *manager, PurpleConnection *pc); + +/** * Removes a media session from the media manager. * * @param manager The media manager to remove the media session from.