pidgin/pidginiconname.c

Sun, 14 Jan 2024 20:08:13 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Sun, 14 Jan 2024 20:08:13 -0600
changeset 42568
31e8c7c92e2f
parent 42541
c5bcc44520c3
child 42700
3e480ee2d7ee
permissions
-rw-r--r--

Make sure all of the license headers for IRCv3 are GPLv2

Testing Done:
Ran `licensecheck` from debian in the following way.

```
$ licensecheck *.[ch] | cut -d: -f 2 | sort | uniq -c
27 GNU General Public License v2.0 or later
```

Reviewed at https://reviews.imfreedom.org/r/2913/

41027
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "pidginiconname.h"
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 /******************************************************************************
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 * Public API
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 *****************************************************************************/
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 const gchar *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 pidgin_icon_name_from_status_primitive(PurpleStatusPrimitive primitive,
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 const gchar *fallback)
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 switch(primitive) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 case PURPLE_STATUS_OFFLINE:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 return "pidgin-user-offline";
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 case PURPLE_STATUS_AVAILABLE:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 return "pidgin-user-available";
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 case PURPLE_STATUS_AWAY:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 return "pidgin-user-away";
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 case PURPLE_STATUS_INVISIBLE:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 return "pidgin-user-invisible";
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 break;
42541
c5bcc44520c3 Embedded the rest of the status icons and removed the unused ones
Gary Kramlich <grim@reaperworld.com>
parents: 42509
diff changeset
45 case PURPLE_STATUS_UNAVAILABLE:
41027
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 case PURPLE_STATUS_EXTENDED_AWAY:
42509
e96a15f7f0d8 Rename PURPLE_PRESENCE_EXTENDED_AWAY to PURPLE_PRESENCE_DO_NOT_DISTURB
Gary Kramlich <grim@reaperworld.com>
parents: 42476
diff changeset
47 return "pidgin-user-do-not-disturb";
41027
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 case PURPLE_STATUS_MOBILE:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 case PURPLE_STATUS_UNSET:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 default:
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 break;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 const gchar *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 pidgin_icon_name_from_status_type(PurpleStatusType *type, const gchar *fallback)
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 PurpleStatusPrimitive primitive;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 if(type == NULL) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 primitive = purple_status_type_get_primitive(type);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 return pidgin_icon_name_from_status_primitive(primitive, fallback);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 const gchar *
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 pidgin_icon_name_from_status(PurpleStatus *status, const gchar *fallback) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 PurpleStatusType *type = NULL;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 if(!PURPLE_IS_STATUS(status)) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 type = purple_status_get_status_type(status);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 if(type == NULL) {
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 return fallback;
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 return pidgin_icon_name_from_status_type(type, fallback);
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87
42476
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
88 const char *
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
89 pidgin_icon_name_from_presence_primitive(PurplePresencePrimitive primitive,
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
90 const char *fallback)
41027
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 {
42476
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
92 switch(primitive) {
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
93 case PURPLE_PRESENCE_PRIMITIVE_OFFLINE:
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
94 return "pidgin-user-offline";
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
95 break;
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
96 case PURPLE_PRESENCE_PRIMITIVE_AVAILABLE:
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
97 return "pidgin-user-available";
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
98 break;
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
99 case PURPLE_PRESENCE_PRIMITIVE_IDLE:
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
100 return "pidgin-user-unavailable";
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
101 break;
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
102 case PURPLE_PRESENCE_PRIMITIVE_INVISIBLE:
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
103 return "pidgin-user-invisible";
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
104 break;
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
105 case PURPLE_PRESENCE_PRIMITIVE_AWAY:
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
106 return "pidgin-user-away";
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
107 break;
42509
e96a15f7f0d8 Rename PURPLE_PRESENCE_EXTENDED_AWAY to PURPLE_PRESENCE_DO_NOT_DISTURB
Gary Kramlich <grim@reaperworld.com>
parents: 42476
diff changeset
108 case PURPLE_PRESENCE_PRIMITIVE_DO_NOT_DISTURB:
e96a15f7f0d8 Rename PURPLE_PRESENCE_EXTENDED_AWAY to PURPLE_PRESENCE_DO_NOT_DISTURB
Gary Kramlich <grim@reaperworld.com>
parents: 42476
diff changeset
109 return "pidgin-user-do-not-disturb";
42476
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
110 break;
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
111 case PURPLE_PRESENCE_PRIMITIVE_STREAMING:
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
112 /* TODO: get an icon for streaming. */
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
113 default:
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
114 break;
41027
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 }
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116
42476
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
117 return fallback;
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
118 }
41027
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119
42476
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
120 const char *
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
121 pidgin_icon_name_from_presence(PurplePresence *presence, const char *fallback)
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
122 {
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
123 PurplePresencePrimitive primitive;
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
124
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
125 primitive = purple_presence_get_primitive(presence);
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
126
5b5e6297cd31 Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents: 42164
diff changeset
127 return pidgin_icon_name_from_presence_primitive(primitive, fallback);
41027
aa0e688f2f46 Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 }

mercurial