| 348 static void |
348 static void |
| 349 test_purple_protocol_conversation_empty_join_channel_cb(GObject *source, |
349 test_purple_protocol_conversation_empty_join_channel_cb(GObject *source, |
| 350 GAsyncResult *result, |
350 GAsyncResult *result, |
| 351 G_GNUC_UNUSED gpointer data) |
351 G_GNUC_UNUSED gpointer data) |
| 352 { |
352 { |
| |
353 PurpleConversation *conversation = NULL; |
| 353 PurpleProtocolConversation *protocol = NULL; |
354 PurpleProtocolConversation *protocol = NULL; |
| 354 GError *error = NULL; |
355 GError *error = NULL; |
| 355 gboolean joined = FALSE; |
|
| 356 |
356 |
| 357 protocol = PURPLE_PROTOCOL_CONVERSATION(source); |
357 protocol = PURPLE_PROTOCOL_CONVERSATION(source); |
| 358 joined = purple_protocol_conversation_join_channel_finish(protocol, result, |
358 conversation = purple_protocol_conversation_join_channel_finish(protocol, |
| 359 &error); |
359 result, |
| |
360 &error); |
| 360 |
361 |
| 361 g_assert_error(error, PURPLE_PROTOCOL_CONVERSATION_DOMAIN, 0); |
362 g_assert_error(error, PURPLE_PROTOCOL_CONVERSATION_DOMAIN, 0); |
| 362 g_clear_error(&error); |
363 g_clear_error(&error); |
| 363 g_assert_false(joined); |
364 g_assert_null(conversation); |
| 364 } |
365 } |
| 365 |
366 |
| 366 static void |
367 static void |
| 367 test_purple_protocol_conversation_empty_join_channel_async(void) { |
368 test_purple_protocol_conversation_empty_join_channel_async(void) { |
| 368 PurpleAccount *account = NULL; |
369 PurpleAccount *account = NULL; |
| 859 if(test_protocol->should_error) { |
860 if(test_protocol->should_error) { |
| 860 GError *error = g_error_new_literal(TEST_PURPLE_PROTOCOL_CONVERSATION_DOMAIN, |
861 GError *error = g_error_new_literal(TEST_PURPLE_PROTOCOL_CONVERSATION_DOMAIN, |
| 861 0, "error"); |
862 0, "error"); |
| 862 g_task_return_error(task, error); |
863 g_task_return_error(task, error); |
| 863 } else { |
864 } else { |
| 864 g_task_return_boolean(task, TRUE); |
865 PurpleConversation *conversation = NULL; |
| |
866 |
| |
867 conversation = g_object_new(PURPLE_TYPE_CONVERSATION, NULL); |
| |
868 g_task_return_pointer(task, conversation, g_object_unref); |
| 865 } |
869 } |
| 866 |
870 |
| 867 g_clear_object(&task); |
871 g_clear_object(&task); |
| 868 } |
872 } |
| 869 |
873 |
| 870 static gboolean |
874 static PurpleConversation * |
| 871 test_purple_protocol_conversation_join_channel_finish(PurpleProtocolConversation *protocol, |
875 test_purple_protocol_conversation_join_channel_finish(PurpleProtocolConversation *protocol, |
| 872 GAsyncResult *result, |
876 GAsyncResult *result, |
| 873 GError **error) |
877 GError **error) |
| 874 { |
878 { |
| 875 TestPurpleProtocolConversation *test_protocol = NULL; |
879 TestPurpleProtocolConversation *test_protocol = NULL; |
| 876 |
880 |
| 877 test_protocol = TEST_PURPLE_PROTOCOL_CONVERSATION(protocol); |
881 test_protocol = TEST_PURPLE_PROTOCOL_CONVERSATION(protocol); |
| 878 test_protocol->join_channel_finish += 1; |
882 test_protocol->join_channel_finish += 1; |
| 879 |
883 |
| 880 return g_task_propagate_boolean(G_TASK(result), error); |
884 return g_task_propagate_pointer(G_TASK(result), error); |
| 881 } |
885 } |
| 882 |
886 |
| 883 static void |
887 static void |
| 884 test_purple_protocol_conversation_set_topic_async(PurpleProtocolConversation *protocol, |
888 test_purple_protocol_conversation_set_topic_async(PurpleProtocolConversation *protocol, |
| 885 PurpleConversation *conversation, |
889 PurpleConversation *conversation, |
| 1497 test_purple_protocol_conversation_join_channel_cb(GObject *obj, |
1501 test_purple_protocol_conversation_join_channel_cb(GObject *obj, |
| 1498 GAsyncResult *res, |
1502 GAsyncResult *res, |
| 1499 G_GNUC_UNUSED gpointer data) |
1503 G_GNUC_UNUSED gpointer data) |
| 1500 { |
1504 { |
| 1501 TestPurpleProtocolConversation *test_protocol = NULL; |
1505 TestPurpleProtocolConversation *test_protocol = NULL; |
| |
1506 PurpleConversation *conversation = NULL; |
| 1502 PurpleProtocolConversation *protocol = NULL; |
1507 PurpleProtocolConversation *protocol = NULL; |
| 1503 GError *error = NULL; |
1508 GError *error = NULL; |
| 1504 gboolean result = FALSE; |
|
| 1505 |
1509 |
| 1506 protocol = PURPLE_PROTOCOL_CONVERSATION(obj); |
1510 protocol = PURPLE_PROTOCOL_CONVERSATION(obj); |
| 1507 test_protocol = TEST_PURPLE_PROTOCOL_CONVERSATION(obj); |
1511 test_protocol = TEST_PURPLE_PROTOCOL_CONVERSATION(obj); |
| 1508 |
1512 |
| 1509 result = purple_protocol_conversation_join_channel_finish(protocol, res, |
1513 conversation = purple_protocol_conversation_join_channel_finish(protocol, |
| 1510 &error); |
1514 res, |
| |
1515 &error); |
| 1511 |
1516 |
| 1512 if(test_protocol->should_error) { |
1517 if(test_protocol->should_error) { |
| 1513 g_assert_error(error, TEST_PURPLE_PROTOCOL_CONVERSATION_DOMAIN, 0); |
1518 g_assert_error(error, TEST_PURPLE_PROTOCOL_CONVERSATION_DOMAIN, 0); |
| 1514 g_clear_error(&error); |
1519 g_clear_error(&error); |
| 1515 g_assert_false(result); |
1520 g_assert_null(conversation); |
| 1516 } else { |
1521 } else { |
| 1517 g_assert_no_error(error); |
1522 g_assert_no_error(error); |
| 1518 g_assert_true(result); |
1523 g_assert_true(PURPLE_IS_CONVERSATION(conversation)); |
| |
1524 g_clear_object(&conversation); |
| 1519 } |
1525 } |
| 1520 } |
1526 } |
| 1521 |
1527 |
| 1522 static void |
1528 static void |
| 1523 test_purple_protocol_conversation_join_channel_normal(gconstpointer data) { |
1529 test_purple_protocol_conversation_join_channel_normal(gconstpointer data) { |