Debian Codegraph @

src/core/xep/muc-affiliation.c

raw symbols SCIP
1 /*
2 * Copyright (C) 2007 Colin DIDIER
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18 #include <string.h>
19
20 #include "module.h"
21
22 #include "muc-affiliation.h"
23
24 const char *xmpp_affiliation[] = {
25 "none",
26 "owner",
27 "admin",
28 "member",
29 "outcast",
30 NULL
31 };
32
33 int
34 xmpp_nicklist_get_affiliation(const char *affiliation)
35 {
36 if (affiliation != NULL) {
37 if (g_ascii_strcasecmp(affiliation,
38 xmpp_affiliation[XMPP_AFFILIATION_OWNER]) == 0)
39 return XMPP_AFFILIATION_OWNER;
40 else if (g_ascii_strcasecmp(affiliation,
41 xmpp_affiliation[XMPP_AFFILIATION_ADMIN]) == 0)
42 return XMPP_AFFILIATION_ADMIN;
43 else if (g_ascii_strcasecmp(affiliation,
44 xmpp_affiliation[XMPP_AFFILIATION_MEMBER]) == 0)
45 return XMPP_AFFILIATION_MEMBER;
46 else if (g_ascii_strcasecmp(affiliation,
47 xmpp_affiliation[XMPP_AFFILIATION_OUTCAST]) == 0)
48 return XMPP_AFFILIATION_OUTCAST;
49 }
50 return XMPP_AFFILIATION_NONE;
51 }