~ubuntu-branches/ubuntu/edgy/ekiga/edgy

« back to all changes in this revision

Viewing changes to lib/gmcontacts/gmcontacts.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-06-26 11:10:35 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060626111035-xapgx0ov26c69t3y
Tags: 2.0.2-1ubuntu1
* Resynchronized with Debian, only Ubuntu changes are:
  - debian/control.in, debian/patches/01_lpi.dpatch, 
    debian/patches/02_autoconf.dpatch: 
    - Launchpad Integration
  - debian/control.in, debian/patches/42_change_pixmaps.dpatch:
    - patched icons.
  - debian/patches/trayicon_transparency.dpatch:
    - upstream fix to enable transparency in the system tray.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#undef _GM_CONTACTS_H_INSIDE__
36
36
#endif
37
37
 
 
38
GSList *
 
39
gmcontact_enum_categories (const GmContact * contact)
 
40
{
 
41
  GSList * categorylist = NULL;
 
42
  gchar ** split_categories = { NULL };
 
43
  gchar ** split_categories_iter = { NULL };
 
44
 
 
45
  g_return_val_if_fail (contact != NULL, NULL);
 
46
 
 
47
  if (!contact->categories)
 
48
    return NULL;
 
49
 
 
50
  if (g_ascii_strcasecmp (contact->categories, "") == 0)
 
51
    return NULL;
 
52
 
 
53
  split_categories =
 
54
    g_strsplit_set (contact->categories,
 
55
                    ",",
 
56
                    -1);
 
57
 
 
58
  for (split_categories_iter = split_categories;
 
59
       *split_categories_iter != NULL;
 
60
       split_categories_iter++) {
 
61
    if (g_ascii_strcasecmp (*split_categories_iter,"") != 0)
 
62
      categorylist =
 
63
        g_slist_append (categorylist, g_strdup (*split_categories_iter));
 
64
  }
 
65
  
 
66
  g_strfreev (split_categories);
 
67
 
 
68
  return categorylist;
 
69
}
 
70
 
 
71
 
 
72
gboolean
 
73
gmcontact_is_in_category (const GmContact * contact,
 
74
                          const gchar * category)
 
75
{
 
76
  GSList * categorylist = NULL;
 
77
  GSList * categorylist_iter = NULL;
 
78
  
 
79
  g_return_val_if_fail (contact != NULL, FALSE);
 
80
 
 
81
  categorylist = gmcontact_enum_categories (contact);
 
82
 
 
83
  if (!categorylist)
 
84
    return FALSE;
 
85
 
 
86
  for (categorylist_iter = categorylist;
 
87
       categorylist_iter != NULL;
 
88
       categorylist_iter = g_slist_next (categorylist_iter))
 
89
    {
 
90
      if (g_ascii_strcasecmp ((const gchar*) categorylist_iter->data,
 
91
                              category) == 0)
 
92
        {
 
93
          g_slist_free (categorylist);
 
94
          return TRUE;
 
95
        }
 
96
    }
 
97
 
 
98
  g_slist_free (categorylist);
 
99
  return FALSE;
 
100
}
 
101
 
38
102
 
39
103
GSList *
40
104
gnomemeeting_addressbook_get_contacts (GmAddressbook *addressbook,