# HG changeset patch # User Nicolas Cornu # Date 1280226029 -7200 # Node ID 0b138243bd4a1265422403e930507b422e853d2e # Parent 56c6ab96026f0cd6292d6e04030a1f78bbed38bb Here the true commit diff -r 56c6ab96026f -r 0b138243bd4a jingle/disco.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jingle/disco.c Tue Jul 27 12:20:29 2010 +0200 @@ -0,0 +1,64 @@ +st/* + * disco.c + * + * Copyrigth (C) 2010 Nicolas Cornu + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#include "config.h" + +#include +#include + +#include + +static gint compare_resources(gconstpointer a, gconstpointer b) +{ + return buddy_getresourceprio(a)-buddy_getresourceprio(b); +} + +GSList* get_sorted_resources(const gchar *jid) +{ + roster *rs; + + GSList *reslist = buddy_search_jid(jid); + + if (reslist == NULL) + return NULL; + + rs = (roster*)reslist->data; + + reslist = buddy_getresources(rs); + + reslist = g_slist_sort(reslist, compare_resources); + + return reslist; +} + +void free_gslist_resources(GSList *reslist) +{ + GSList *el; + roster *rs; + + for (el=reslist; el; el=el->next) { + rs=(roster*)el->data; + free_roster_user_data(rs); + } + g_slist_free(reslist); +} + + diff -r 56c6ab96026f -r 0b138243bd4a jingle/disco.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jingle/disco.h Tue Jul 27 12:20:29 2010 +0200 @@ -0,0 +1,11 @@ +#ifndef __JINGLE_CHECK_H__ +#define __JINGLE_CHECK_H__ 1 + +#include +#include + +#include + +GSList* get_sorted_resources(const gchar *jid); +void free_gslist_resources(GSList *reslist); +#endif