Debian Codegraph @

src/core/xep/muc-role.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 <glib.h>
21
22 #include "muc-role.h"
23
24 const char *xmpp_role[] = {
25 "none",
26 "moderator",
27 "participant",
28 "visitor",
29 NULL
30 };
31
32 int
33 xmpp_nicklist_get_role(const char *role)
34 {
35 if (role != NULL) {
36 if (g_ascii_strcasecmp(role,
37 xmpp_role[XMPP_ROLE_MODERATOR]) == 0)
38 return XMPP_ROLE_MODERATOR;
39 else if (g_ascii_strcasecmp(role,
40 xmpp_role[XMPP_ROLE_PARTICIPANT]) == 0)
41 return XMPP_ROLE_PARTICIPANT;
42 else if (g_ascii_strcasecmp(role,
43 xmpp_role[XMPP_ROLE_VISITOR]) == 0)
44 return XMPP_ROLE_VISITOR;
45 }
46 return XMPP_ROLE_NONE;
47 }