about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/contact.c6
-rw-r--r--tests/test_contact.c13
-rw-r--r--tests/test_contact.h1
-rw-r--r--tests/testsuite.c1
4 files changed, 18 insertions, 3 deletions
diff --git a/src/contact.c b/src/contact.c
index b2bef275..f2f74349 100644
--- a/src/contact.c
+++ b/src/contact.c
@@ -171,9 +171,9 @@ p_contact_create_display_string(const PContact contact, const char * const resou
 {
     GString *result_str = g_string_new("");
 
-    // use nickname if exists                                                         
-    const char *display_name = p_contact_name_or_jid(contact);                   
-    g_string_append(result_str, display_name);   
+    // use nickname if exists
+    const char *display_name = p_contact_name_or_jid(contact);
+    g_string_append(result_str, display_name);
 
     // add resource if not default provided by profanity
     if (strcmp(resource, "__prof_default") != 0) {
diff --git a/tests/test_contact.c b/tests/test_contact.c
index 332d6fd2..4952a271 100644
--- a/tests/test_contact.c
+++ b/tests/test_contact.c
@@ -100,3 +100,16 @@ void contact_string_when_default_resource(void **state)
     p_contact_free(contact);
     free(str);
 }
+
+void contact_presence_offline(void **state)
+{
+    PContact contact = p_contact_new("bob@server.com", "bob", NULL, "both",
+        "is offline", FALSE);
+
+    const char *presence = p_contact_presence(contact);
+
+    assert_string_equal("offline", presence);
+
+    p_contact_free(contact);
+
+}
diff --git a/tests/test_contact.h b/tests/test_contact.h
index f0ba043f..f196ff65 100644
--- a/tests/test_contact.h
+++ b/tests/test_contact.h
@@ -5,3 +5,4 @@ void contact_jid_when_name_not_exists(void **state);
 void contact_string_when_name_exists(void **state);
 void contact_string_when_name_not_exists(void **state);
 void contact_string_when_default_resource(void **state);
+void contact_presence_offline(void **state);
diff --git a/tests/testsuite.c b/tests/testsuite.c
index 71f2fdf9..6a107dd2 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -265,6 +265,7 @@ int main(int argc, char* argv[]) {
         unit_test(contact_string_when_name_exists),
         unit_test(contact_string_when_name_not_exists),
         unit_test(contact_string_when_default_resource),
+        unit_test(contact_presence_offline),
     };
     return run_tests(tests);
 }
156'>156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240