Mon, 13 Jan 2025 02:36:10 -0600
Add some additional methods to Purple.ProtocolConversation
This adds virtual functions for setting the title and description as well as
some additional implements methods that we were missing.
Testing Done:
Ran the tests under valgrind and called in the turtles.
Bugs closed: PIDGIN-18026
Reviewed at https://reviews.imfreedom.org/r/3738/
|
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 | *****************************************************************************/ |
|
42476
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
28 | const char * |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
29 | 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
|
30 | const char *fallback) |
|
41027
aa0e688f2f46
Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | { |
|
42476
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
32 | switch(primitive) { |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
33 | case PURPLE_PRESENCE_PRIMITIVE_OFFLINE: |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
34 | return "pidgin-user-offline"; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
35 | break; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
36 | case PURPLE_PRESENCE_PRIMITIVE_AVAILABLE: |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
37 | return "pidgin-user-available"; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
38 | break; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
39 | case PURPLE_PRESENCE_PRIMITIVE_IDLE: |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
40 | return "pidgin-user-unavailable"; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
41 | break; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
42 | case PURPLE_PRESENCE_PRIMITIVE_INVISIBLE: |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
43 | return "pidgin-user-invisible"; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
44 | break; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
45 | case PURPLE_PRESENCE_PRIMITIVE_AWAY: |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
46 | return "pidgin-user-away"; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
47 | break; |
|
42509
e96a15f7f0d8
Rename PURPLE_PRESENCE_EXTENDED_AWAY to PURPLE_PRESENCE_DO_NOT_DISTURB
Gary Kramlich <grim@reaperworld.com>
parents:
42476
diff
changeset
|
48 | 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
|
49 | 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
|
50 | break; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
51 | case PURPLE_PRESENCE_PRIMITIVE_STREAMING: |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
52 | /* TODO: get an icon for streaming. */ |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
53 | default: |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
54 | break; |
|
41027
aa0e688f2f46
Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | } |
|
aa0e688f2f46
Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | |
|
42476
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
57 | return fallback; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
58 | } |
|
41027
aa0e688f2f46
Add a bunch of icon name utility functions
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | |
|
42476
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
60 | const char * |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
61 | 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
|
62 | { |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
63 | PurplePresencePrimitive primitive; |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
64 | |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
65 | primitive = purple_presence_get_primitive(presence); |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
66 | |
|
5b5e6297cd31
Add a pidgin_icon_name_from_presence_primitive
Gary Kramlich <grim@reaperworld.com>
parents:
42164
diff
changeset
|
67 | 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
|
68 | } |