Mon, 12 May 2025 20:25:16 -0500
Handle formatting in server messages
Testing Done:
Used the default motd on my local ergo server to verify that formatting was working.
Reviewed at https://reviews.imfreedom.org/r/3991/
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib.h> |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include <purple.h> |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | /****************************************************************************** |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | * Callbacks |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | *****************************************************************************/ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | test_purple_notification_add_contact_notify_cb(GObject *obj, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | G_GNUC_UNUSED GParamSpec *pspec, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | gpointer data) |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | guint *counter = data; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | g_assert_true(PURPLE_IS_NOTIFICATION(obj)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | g_assert_true(PURPLE_IS_NOTIFICATION_ADD_CONTACT(obj)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | *counter = *counter + 1; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | /****************************************************************************** |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | * Tests |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | *****************************************************************************/ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | test_purple_notification_add_contact_new(void) { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | PurpleAccount *account = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | PurpleAddContactRequest *request = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | PurpleContact *contact = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | PurpleNotification *notification = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | account = purple_account_new("test", "test"); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | contact = purple_contact_new(account, "remote"); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | request = purple_add_contact_request_new(contact); |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
52 | notification = purple_notification_add_contact_new(NULL, request); |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | g_assert_true(PURPLE_IS_NOTIFICATION(notification)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | g_assert_true(PURPLE_IS_NOTIFICATION_ADD_CONTACT(notification)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | g_assert_finalize_object(notification); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | g_clear_object(&request); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | g_clear_object(&contact); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | g_clear_object(&account); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | test_purple_notification_add_contact_properties(void) { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | PurpleAccount *account = NULL; |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
67 | PurpleAccount *account1 = NULL; |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | PurpleAddContactRequest *request = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | PurpleAddContactRequest *request1 = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | PurpleContact *contact = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | PurpleNotification *notification = NULL; |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
72 | char *id = NULL; |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | account = purple_account_new("test", "test"); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | contact = purple_contact_new(account, "username"); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | request = purple_add_contact_request_new(contact); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | notification = g_object_new( |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | PURPLE_TYPE_NOTIFICATION_ADD_CONTACT, |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
80 | "id", "notification1", |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | "request", request, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | NULL); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | g_object_get( |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | notification, |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
86 | "account", &account1, |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
87 | "id", &id, |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | "request", &request1, |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | NULL); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
91 | g_assert_true(account1 == account); |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
92 | g_clear_object(&account1); |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
93 | |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
94 | g_assert_cmpstr(id, ==, "notification1"); |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
95 | g_clear_pointer(&id, g_free); |
|
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
96 | |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | g_assert_true(request1 == request); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | g_clear_object(&request1); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | g_assert_finalize_object(notification); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | g_assert_finalize_object(request); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | g_assert_finalize_object(contact); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | g_clear_object(&account); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | static void |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | test_purple_notification_add_contact_updates_title(void) { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | PurpleAccount *account = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | PurpleAddContactRequest *request = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | PurpleContact *contact = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | PurpleNotification *notification = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | const char *title = NULL; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | guint counter = 0; |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | account = purple_account_new("test", "test"); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | contact = purple_contact_new(account, "remote-username"); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | request = purple_add_contact_request_new(contact); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | |
|
42928
2f12cdef0048
Update Purple.NotificationAddContact to take an id parameter
Gary Kramlich <grim@reaperworld.com>
parents:
42922
diff
changeset
|
120 | notification = purple_notification_add_contact_new(NULL, request); |
|
42922
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | g_signal_connect(notification, "notify::title", |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | G_CALLBACK(test_purple_notification_add_contact_notify_cb), |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | &counter); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | /* Make sure the id is in the title after construction. */ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | title = purple_notification_get_title(notification); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | g_assert_true(g_pattern_match_simple("*remote-username*", title)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | /* Set the alias and make sure the title gets updated. */ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | g_assert_cmpuint(counter, ==, 0); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | purple_contact_info_set_alias(PURPLE_CONTACT_INFO(contact), "test-alias"); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | g_assert_cmpuint(counter, ==, 1); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | title = purple_notification_get_title(notification); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | g_assert_true(g_pattern_match_simple("*test-alias*", title)); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | g_assert_finalize_object(notification); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | g_assert_finalize_object(request); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | g_assert_finalize_object(contact); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | g_clear_object(&account); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | } |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | /****************************************************************************** |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | * Main |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | *****************************************************************************/ |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | int |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | main(int argc, char *argv[]) { |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | g_test_init(&argc, &argv, NULL); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | g_test_set_nonfatal_assertions(); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | g_test_add_func("/notification/add-contact/new", |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | test_purple_notification_add_contact_new); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | g_test_add_func("/notification/add-contact/properties", |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | test_purple_notification_add_contact_properties); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | g_test_add_func("/notification/add-contact/updates-title", |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | test_purple_notification_add_contact_updates_title); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | return g_test_run(); |
|
46b64a8cbec4
Create Purple.NotificationAddContact
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | } |