mcabber/src/roster.c
changeset 1438 c5d937d5530b
parent 1437 071c8170b7de
child 1444 3bf11085c6a5
equal deleted inserted replaced
1437:071c8170b7de 1438:c5d937d5530b
  1554   if (!unread_jids)
  1554   if (!unread_jids)
  1555     return FALSE;
  1555     return FALSE;
  1556   return g_hash_table_remove(unread_jids, jid);
  1556   return g_hash_table_remove(unread_jids, jid);
  1557 }
  1557 }
  1558 
  1558 
       
  1559 // Helper function for unread_jid_get_list()
       
  1560 static void add_to_unreadjids(gpointer key, gpointer value, gpointer udata)
       
  1561 {
       
  1562   GList **listp = udata;
       
  1563   *listp = g_list_append(*listp, key);
       
  1564 }
       
  1565 
  1559 //  unread_jid_get_list()
  1566 //  unread_jid_get_list()
  1560 // Return the JID list.
  1567 // Return the JID list.
  1561 // The content of the list should not be modified or freed.
  1568 // The content of the list should not be modified or freed.
  1562 // The caller should call g_list_free() after use.
  1569 // The caller should call g_list_free() after use.
  1563 GList *unread_jid_get_list(void)
  1570 GList *unread_jid_get_list(void)
  1564 {
  1571 {
       
  1572   GList *list = NULL;
       
  1573 
  1565   if (!unread_jids)
  1574   if (!unread_jids)
  1566     return NULL;
  1575     return NULL;
  1567   return g_hash_table_get_keys(unread_jids);
  1576 
       
  1577   // g_hash_table_get_keys() is only in glib >= 2.14
       
  1578   //return g_hash_table_get_keys(unread_jids);
       
  1579 
       
  1580   g_hash_table_foreach(unread_jids, add_to_unreadjids, &list);
       
  1581   return list;
  1568 }
  1582 }
  1569 
  1583 
  1570 /* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */
  1584 /* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */