Thu, 23 Mar 2023 23:11:59 -0500
Fix several leaks in tests
All of these are specific to tests, not the library code.
For the moment, `protocol_xfer` still leaks connections (and anything they hold on to) because it is very difficult to disentangle them from the connection manager in the partially implemented state they are in.
This fixes leaks of options in the account option test (these two leaks occur for every test since they all leak the option):
```
61 (48 direct, 13 indirect) bytes in 1 blocks are definitely lost in loss record 133 of 276
at 0x4848464: calloc (vg_replace_malloc.c:1340)
by 0x49F75F0: g_malloc0 (gmem.c:163)
by 0x48C3B2E: purple_account_option_new (purpleaccountoption.c:78)
by 0x4014AF: test_purple_account_option_copy_int (test_account_option.c:67)
by 0x4A1CC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A1CC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1D181: g_test_run_suite (gtestutils.c:3115)
by 0x4A156EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A156EC: g_test_run (gtestutils.c:2221)
by 0x401721: main (test_account_option.c:157)
61 (48 direct, 13 indirect) bytes in 1 blocks are definitely lost in loss record 134 of 276
at 0x4848464: calloc (vg_replace_malloc.c:1340)
by 0x49F75F0: g_malloc0 (gmem.c:163)
by 0x48C3BC7: purple_account_option_copy (purpleaccountoption.c:93)
by 0x4014BF: test_purple_account_option_copy_int (test_account_option.c:68)
by 0x4A1CC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A1CC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1D181: g_test_run_suite (gtestutils.c:3115)
by 0x4A156EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A156EC: g_test_run (gtestutils.c:2221)
by 0x401721: main (test_account_option.c:157)
```
leaks in the credential manager test (times 3 for read/write/cancel tests):
```
69 (16 direct, 53 indirect) bytes in 1 blocks are definitely lost in loss record 2,427 of 3,503
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x4A58168: g_malloc (gmem.c:130)
by 0x4A6FAB5: g_slice_alloc (gslice.c:1074)
by 0x4A700EC: g_slice_alloc0 (gslice.c:1100)
by 0x4A3BECB: g_error_allocate (gerror.c:710)
by 0x4A3C93F: UnknownInlinedFun (gerror.c:724)
by 0x4A3C93F: g_error_new_valist (gerror.c:766)
by 0x4BEE558: g_task_return_new_error (gtask.c:1941)
by 0x48D82C0: purple_credential_manager_read_password_async (purplecredentialmanager.c:492)
by 0x403634: test_purple_credential_manager_no_provider_read_password_idle (test_credential_manager.c:329)
by 0x4A4ECB1: g_idle_dispatch (gmain.c:6124)
by 0x4A4FCBE: UnknownInlinedFun (gmain.c:3444)
by 0x4A4FCBE: g_main_context_dispatch (gmain.c:4162)
by 0x4AA5597: g_main_context_iterate.constprop.0 (gmain.c:4238)
by 0x4A4F28E: g_main_loop_run (gmain.c:4438)
by 0x40369F: test_purple_credential_manager_no_provider_read_password_async (test_credential_manager.c:345)
by 0x4A7DC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A7DC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A7D9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A7D9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A7E181: g_test_run_suite (gtestutils.c:3115)
by 0x4A766EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A766EC: g_test_run (gtestutils.c:2221)
by 0x4048F6: main (test_credential_manager.c:695)
```
a leak in the image test:
```
161 bytes in 1 blocks are definitely lost in loss record 260 of 274
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x4A55363: g_try_malloc (gmem.c:286)
by 0x4A3D630: UnknownInlinedFun (gfileutils.c:819)
by 0x4A3D630: UnknownInlinedFun (gfileutils.c:924)
by 0x4A3D630: g_file_get_contents (gfileutils.c:1027)
by 0x401890: test_image_new_from_file (test_image.c:144)
by 0x4A7DC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A7DC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A7D9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A7E181: g_test_run_suite (gtestutils.c:3115)
by 0x4A766EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A766EC: g_test_run (gtestutils.c:2221)
by 0x40195D: main (test_image.c:172)
```
a leak in queued output stream test:
```
72 (40 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 219 of 396
at 0x49D51EF: g_type_create_instance (gtype.c:1909)
by 0x49BAC1F: g_object_new_internal (gobject.c:2228)
by 0x49BC247: g_object_new_with_properties (gobject.c:2391)
by 0x49BCFF0: g_object_new (gobject.c:2037)
by 0x402003: test_queued_output_stream_push_bytes_async_error (test_queued_output_stream.c:219)
by 0x4A7DC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A7DC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A7D9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A7E181: g_test_run_suite (gtestutils.c:3115)
by 0x4A766EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A766EC: g_test_run (gtestutils.c:2221)
by 0x402429: main (test_queued_output_stream.c:280)
```
and protocol xfer tests (times 3 for each test that creates a test protocol object):
```
112 (48 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 3,430 of 3,698
at 0x49D51EF: g_type_create_instance (gtype.c:1909)
by 0x49BAC1F: g_object_new_internal (gobject.c:2228)
by 0x49BC247: g_object_new_with_properties (gobject.c:2391)
by 0x49BCFF0: g_object_new (gobject.c:2037)
by 0x40291C: test_purple_protocol_xfer_send_file_func (test_protocol_xfer.c:146)
by 0x4A7DC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A7DC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A7D9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A7E181: g_test_run_suite (gtestutils.c:3115)
by 0x4A766EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A766EC: g_test_run (gtestutils.c:2221)
by 0x402B64: main (test_protocol_xfer.c:195)
```
and util tests (times 3 for each call to `purple_text_strip_mnemonic` in the test):
```
5 bytes in 1 blocks are definitely lost in loss record 5 of 247
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x49F7168: g_malloc (gmem.c:130)
by 0x491975B: purple_text_strip_mnemonic (util.c:895)
by 0x4015B0: test_util_text_strip_mnemonic (test_util.c:49)
by 0x4A1CC7D: UnknownInlinedFun (gtestutils.c:2933)
by 0x4A1CC7D: g_test_run_suite_internal (gtestutils.c:3021)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1C9E4: g_test_run_suite_internal (gtestutils.c:3038)
by 0x4A1D181: g_test_run_suite (gtestutils.c:3115)
by 0x4A156EC: UnknownInlinedFun (gtestutils.c:2234)
by 0x4A156EC: g_test_run (gtestutils.c:2221)
by 0x401901: main (test_util.c:224)
```
and these leaks in any test that initializes the test UI:
```
4,104 bytes in 1 blocks are possibly lost in loss record 3,451 of 3,457
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x5235B67: sqlite3MemMalloc.lto_priv.0 (sqlite3.c:25493)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29181)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29227)
by 0x5232797: sqlite3Malloc.lto_priv.0 (sqlite3.c:29221)
by 0x523BD8B: pcache1Alloc.lto_priv.0 (sqlite3.c:53546)
by 0x5249A8B: UnknownInlinedFun (sqlite3.c:53675)
by 0x5249A8B: allocateTempSpace (sqlite3.c:70848)
by 0x52625A6: sqlite3VdbeExec.lto_priv.0 (sqlite3.c:93857)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:87995)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:88056)
by 0x525CBEE: sqlite3_step (sqlite3.c:88045)
by 0x529B324: sqlite3_exec (sqlite3.c:131002)
by 0x48FD558: purple_sqlite3_run_migration (purplesqlite3.c:37)
by 0x48FDBB4: purple_sqlite3_run_migrations_from_resources (purplesqlite3.c:195)
by 0x48FDED9: purple_sqlite_history_adapter_run_migrations (purplesqlitehistoryadapter.c:69)
by 0x48FE7F0: purple_sqlite_history_adapter_activate (purplesqlitehistoryadapter.c:287)
by 0x48DB656: purple_history_adapter_activate (purplehistoryadapter.c:181)
by 0x48DC9BC: purple_history_manager_set_active (purplehistorymanager.c:308)
by 0x402BA8: test_ui_init_history (test_ui.c:132)
by 0x402C80: test_ui_purple_init (test_ui.c:167)
by 0x4027BB: main (test_contact.c:88)
4,368 bytes in 1 blocks are possibly lost in loss record 3,453 of 3,457
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x5235B67: sqlite3MemMalloc.lto_priv.0 (sqlite3.c:25493)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29181)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29227)
by 0x5232797: sqlite3Malloc.lto_priv.0 (sqlite3.c:29221)
by 0x523BD8B: pcache1Alloc.lto_priv.0 (sqlite3.c:53546)
by 0x5240077: UnknownInlinedFun (sqlite3.c:53634)
by 0x5240077: pcache1FetchStage2 (sqlite3.c:54104)
by 0x5243E9C: UnknownInlinedFun (sqlite3.c:52671)
by 0x5243E9C: getPageNormal.lto_priv.0 (sqlite3.c:60628)
by 0x524A510: UnknownInlinedFun (sqlite3.c:60805)
by 0x524A510: btreeGetPage.lto_priv.0 (sqlite3.c:70289)
by 0x524C2F6: UnknownInlinedFun (sqlite3.c:71257)
by 0x524C2F6: sqlite3BtreeBeginTrans.lto_priv.0 (sqlite3.c:71647)
by 0x5266B3A: sqlite3VdbeExec.lto_priv.0 (sqlite3.c:93532)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:87995)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:88056)
by 0x525CBEE: sqlite3_step (sqlite3.c:88045)
by 0x48FD715: purple_sqlite3_get_schema_version (purplesqlite3.c:79)
by 0x48FD9DD: purple_sqlite3_run_migrations_from_resources (purplesqlite3.c:146)
by 0x48FDED9: purple_sqlite_history_adapter_run_migrations (purplesqlitehistoryadapter.c:69)
by 0x48FE7F0: purple_sqlite_history_adapter_activate (purplesqlitehistoryadapter.c:287)
by 0x48DB656: purple_history_adapter_activate (purplehistoryadapter.c:181)
by 0x48DC9BC: purple_history_manager_set_active (purplehistorymanager.c:308)
by 0x402BA8: test_ui_init_history (test_ui.c:132)
by 0x402C80: test_ui_purple_init (test_ui.c:167)
by 0x4027BB: main (test_contact.c:88)
4,368 bytes in 1 blocks are possibly lost in loss record 3,454 of 3,457
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x5235B67: sqlite3MemMalloc.lto_priv.0 (sqlite3.c:25493)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29181)
by 0x5232797: UnknownInlinedFun (sqlite3.c:29227)
by 0x5232797: sqlite3Malloc.lto_priv.0 (sqlite3.c:29221)
by 0x523BD8B: pcache1Alloc.lto_priv.0 (sqlite3.c:53546)
by 0x5240077: UnknownInlinedFun (sqlite3.c:53634)
by 0x5240077: pcache1FetchStage2 (sqlite3.c:54104)
by 0x5243E9C: UnknownInlinedFun (sqlite3.c:52671)
by 0x5243E9C: getPageNormal.lto_priv.0 (sqlite3.c:60628)
by 0x52499BC: UnknownInlinedFun (sqlite3.c:60805)
by 0x52499BC: UnknownInlinedFun (sqlite3.c:70289)
by 0x52499BC: btreeGetUnusedPage (sqlite3.c:70432)
by 0x524F504: allocateBtreePage.lto_priv.0 (sqlite3.c:74604)
by 0x5256209: btreeCreateTable.lto_priv.0 (sqlite3.c:77830)
by 0x5265EB2: UnknownInlinedFun (sqlite3.c:77849)
by 0x5265EB2: sqlite3VdbeExec.lto_priv.0 (sqlite3.c:96382)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:87995)
by 0x525CBEE: UnknownInlinedFun (sqlite3.c:88056)
by 0x525CBEE: sqlite3_step (sqlite3.c:88045)
by 0x529B324: sqlite3_exec (sqlite3.c:131002)
by 0x48FD558: purple_sqlite3_run_migration (purplesqlite3.c:37)
by 0x48FDBB4: purple_sqlite3_run_migrations_from_resources (purplesqlite3.c:195)
by 0x48FDED9: purple_sqlite_history_adapter_run_migrations (purplesqlitehistoryadapter.c:69)
by 0x48FE7F0: purple_sqlite_history_adapter_activate (purplesqlitehistoryadapter.c:287)
by 0x48DB656: purple_history_adapter_activate (purplehistoryadapter.c:181)
by 0x48DC9BC: purple_history_manager_set_active (purplehistorymanager.c:308)
by 0x402BA8: test_ui_init_history (test_ui.c:132)
by 0x402C80: test_ui_purple_init (test_ui.c:167)
by 0x4027BB: main (test_contact.c:88)
```
Testing Done:
Ran tests in valgrind, and all above leaks were gone except for noted `protocol_xfer` issues, and a bunch of leaks of the `PurpleBuddy`-`PurpleContact` compatibility bindings, which will go away in their entirety eventually.
Reviewed at https://reviews.imfreedom.org/r/2385/
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
1 | /* |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "pidginmessage.h" |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
25 | #include "pidginattachment.h" |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
26 | #include "pidgincolor.h" |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
27 | |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | struct _PidginMessage { |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | GObject parent; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
31 | PurpleMessage *message; |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | }; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
34 | typedef struct { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
35 | TalkatuAttachmentForeachFunc func; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
36 | gpointer data; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
37 | } PidginMessageAttachmentForeachData; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
38 | |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | enum { |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | PROP_0, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | PROP_MESSAGE, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | N_PROPERTIES, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | /* overrides */ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | PROP_ID = N_PROPERTIES, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | PROP_CONTENT_TYPE, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | PROP_AUTHOR, |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
47 | PROP_AUTHOR_NAME_COLOR, |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | PROP_CONTENTS, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | PROP_TIMESTAMP, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | PROP_EDITED, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | }; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | static GParamSpec *properties[N_PROPERTIES] = {NULL, }; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | /****************************************************************************** |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | * Helpers |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | *****************************************************************************/ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | static void |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
58 | pidgin_message_set_message(PidginMessage *message, PurpleMessage *purple_msg) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
59 | if(g_set_object(&message->message, purple_msg)) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
60 | g_object_notify_by_pspec(G_OBJECT(message), properties[PROP_MESSAGE]); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
64 | static GdkRGBA * |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
65 | pidgin_message_parse_author_name_color(PidginMessage *message) { |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
66 | GdkRGBA *ret = NULL; |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
67 | const gchar *color = NULL; |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
68 | gboolean set = FALSE; |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
69 | |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
70 | ret = g_new0(GdkRGBA, 1); |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
71 | |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
72 | color = purple_message_get_author_name_color(message->message); |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
73 | if(color != NULL && gdk_rgba_parse(ret, color)) { |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
74 | set = TRUE; |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
75 | } |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
76 | |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
77 | if(!set) { |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
78 | const gchar *author = purple_message_get_author_alias(message->message); |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
79 | |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
80 | if(author == NULL) { |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
81 | author = purple_message_get_author(message->message); |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
82 | } |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
83 | |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
84 | pidgin_color_calculate_for_text(author, ret); |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
85 | } |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
86 | |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
87 | return ret; |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
88 | } |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
89 | |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | /****************************************************************************** |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | * TalkatuMessage Implementation |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | *****************************************************************************/ |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
93 | static gboolean |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
94 | pidgin_message_add_attachment(TalkatuMessage *tmessage, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
95 | TalkatuAttachment *tattachment) |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
96 | { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
97 | PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
98 | PurpleAttachment *pattachment = NULL; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
99 | gboolean ret = FALSE; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
100 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
101 | pattachment = purple_attachment_new( |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
102 | talkatu_attachment_get_id(tattachment), |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
103 | talkatu_attachment_get_content_type(tattachment) |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
104 | ); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
105 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
106 | ret = purple_message_add_attachment(pmessage->message, pattachment); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
107 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
108 | g_object_unref(G_OBJECT(pattachment)); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
109 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
110 | return ret; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
111 | } |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
112 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
113 | static gboolean |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
114 | pidgin_message_remove_attachment(TalkatuMessage *tmessage, guint64 id) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
115 | PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
116 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
117 | return purple_message_remove_attachment(pmessage->message, id); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
118 | } |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
119 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
120 | static TalkatuAttachment * |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
121 | pidgin_message_get_attachment(TalkatuMessage *tmessage, guint64 id) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
122 | PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
123 | PidginAttachment *pidgin_attachment = NULL; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
124 | PurpleAttachment *purple_attachment = NULL; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
125 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
126 | purple_attachment = purple_message_get_attachment(pmessage->message, id); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
127 | pidgin_attachment = pidgin_attachment_new(purple_attachment); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
128 | g_object_unref(G_OBJECT(purple_attachment)); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
129 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
130 | return TALKATU_ATTACHMENT(pidgin_attachment); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
131 | } |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
132 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
133 | static void |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
134 | pidgin_message_foreach_attachment_helper(PurpleAttachment *attachment, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
135 | gpointer data) |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
136 | { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
137 | PidginAttachment *pidgin_attachment = NULL; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
138 | PidginMessageAttachmentForeachData *d = NULL; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
139 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
140 | d = (PidginMessageAttachmentForeachData *)data; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
141 | pidgin_attachment = pidgin_attachment_new(attachment); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
142 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
143 | d->func(TALKATU_ATTACHMENT(pidgin_attachment), d->data); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
144 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
145 | g_object_unref(G_OBJECT(pidgin_attachment)); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
146 | } |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
147 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
148 | static void |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
149 | pidgin_message_foreach_attachment(TalkatuMessage *tmessage, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
150 | TalkatuAttachmentForeachFunc func, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
151 | gpointer data) |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
152 | { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
153 | PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
154 | PidginMessageAttachmentForeachData *d = NULL; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
155 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
156 | /* PurpleAttachmentForeachFunc and TalkatuAttachmentForeachFunc may not |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
157 | * always have the same signature. So to work around that, we use a helper |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
158 | * function that has the signature of PurpleAttachmentForeachFunc but will |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
159 | * call the TalkatuAttachmentForeachFunc while also wrapping the |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
160 | * PurpleAttachments. |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
161 | */ |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
162 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
163 | d = g_new(PidginMessageAttachmentForeachData, 1); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
164 | d->func = func; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
165 | d->data = data; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
166 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
167 | purple_message_foreach_attachment( |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
168 | pmessage->message, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
169 | pidgin_message_foreach_attachment_helper, |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
170 | d |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
171 | ); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
172 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
173 | g_free(d); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
174 | } |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
175 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
176 | static void |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
177 | pidgin_message_clear_attachments(TalkatuMessage *tmessage) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
178 | PidginMessage *pmessage = PIDGIN_MESSAGE(tmessage); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
179 | |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
180 | purple_message_clear_attachments(pmessage->message); |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
181 | } |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
182 | |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | static void |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | pidgin_message_talkatu_message_init(TalkatuMessageInterface *iface) { |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
185 | iface->add_attachment = pidgin_message_add_attachment; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
186 | iface->remove_attachment = pidgin_message_remove_attachment; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
187 | iface->get_attachment = pidgin_message_get_attachment; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
188 | iface->foreach_attachment = pidgin_message_foreach_attachment; |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
189 | iface->clear_attachments = pidgin_message_clear_attachments; |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | /****************************************************************************** |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | * GObject Implementation |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | *****************************************************************************/ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | G_DEFINE_TYPE_EXTENDED( |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | PidginMessage, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | pidgin_message, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | G_TYPE_OBJECT, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | 0, |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
200 | G_IMPLEMENT_INTERFACE(TALKATU_TYPE_MESSAGE, |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
201 | pidgin_message_talkatu_message_init) |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | ); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | static void |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
205 | pidgin_message_get_property(GObject *obj, guint param_id, GValue *value, |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
206 | GParamSpec *pspec) |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
207 | { |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
208 | PidginMessage *message = PIDGIN_MESSAGE(obj); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | switch(param_id) { |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | case PROP_MESSAGE: |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
212 | g_value_set_object(value, message->message); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | case PROP_ID: |
|
41019
f1bdc43bf086
Change PurpleMessage:id to a string and add author-name-color to the property getter/setter.
Gary Kramlich <grim@reaperworld.com>
parents:
40951
diff
changeset
|
215 | g_value_set_string(value, purple_message_get_id(message->message)); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | case PROP_CONTENT_TYPE: |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | g_value_set_enum(value, TALKATU_CONTENT_TYPE_PLAIN); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | case PROP_AUTHOR: |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
221 | g_value_set_string(value, |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
222 | purple_message_get_author(message->message)); |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
223 | break; |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
224 | case PROP_AUTHOR_NAME_COLOR: |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
225 | g_value_take_boxed(value, |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
226 | pidgin_message_parse_author_name_color(message)); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | case PROP_CONTENTS: |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
229 | g_value_set_string(value, |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
230 | purple_message_get_contents(message->message)); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | case PROP_TIMESTAMP: |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
233 | g_value_set_boxed(value, |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
234 | purple_message_get_timestamp(message->message)); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | case PROP_EDITED: |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | g_value_set_boolean(value, FALSE); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | default: |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | static void |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
246 | pidgin_message_set_property(GObject *obj, guint param_id, const GValue *value, |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
247 | GParamSpec *pspec) |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
248 | { |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
249 | PidginMessage *message = PIDGIN_MESSAGE(obj); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 | switch(param_id) { |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | case PROP_MESSAGE: |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
253 | pidgin_message_set_message(message, g_value_get_object(value)); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | break; |
|
39704
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
255 | case PROP_ID: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
256 | case PROP_CONTENT_TYPE: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
257 | case PROP_TIMESTAMP: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
258 | case PROP_AUTHOR: |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
259 | case PROP_AUTHOR_NAME_COLOR: |
|
39704
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
260 | case PROP_CONTENTS: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
261 | case PROP_EDITED: |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
262 | /* we don't allow settings these */ |
|
8f0ffe559ea0
Some additional cleanups
Gary Kramlich <grim@reaperworld.com>
parents:
39702
diff
changeset
|
263 | break; |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | default: |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | break; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41019
diff
changeset
|
271 | pidgin_message_init(G_GNUC_UNUSED PidginMessage *message) { |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | static void |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
275 | pidgin_message_finalize(GObject *obj) { |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
276 | PidginMessage *message = PIDGIN_MESSAGE(obj); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
278 | g_clear_object(&message->message); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
280 | G_OBJECT_CLASS(pidgin_message_parent_class)->finalize(obj); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | static void |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | pidgin_message_class_init(PidginMessageClass *klass) { |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | obj_class->get_property = pidgin_message_get_property; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | obj_class->set_property = pidgin_message_set_property; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | obj_class->finalize = pidgin_message_finalize; |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | /* add our custom properties */ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
292 | properties[PROP_MESSAGE] = g_param_spec_object( |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | "message", "message", "The purple message", |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | PURPLE_TYPE_MESSAGE, |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | ); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | /* add our overridden properties */ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | g_object_class_override_property(obj_class, PROP_ID, "id"); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | g_object_class_override_property(obj_class, PROP_TIMESTAMP, "timestamp"); |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
303 | g_object_class_override_property(obj_class, PROP_CONTENT_TYPE, |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
304 | "content-type"); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | g_object_class_override_property(obj_class, PROP_AUTHOR, "author"); |
|
40951
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
306 | g_object_class_override_property(obj_class, PROP_AUTHOR_NAME_COLOR, |
|
c83bf354d142
Add support for the author-name-color property to PidginMessage and wire it up in PurpleMessage as well
Gary Kramlich <grim@reaperworld.com>
parents:
40541
diff
changeset
|
307 | "author-name-color"); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | g_object_class_override_property(obj_class, PROP_CONTENTS, "contents"); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
309 | g_object_class_override_property(obj_class, PROP_EDITED, "edited"); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
310 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
312 | /****************************************************************************** |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | * API |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | *****************************************************************************/ |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | PidginMessage * |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
316 | pidgin_message_new(PurpleMessage *message) { |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | return g_object_new( |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | PIDGIN_TYPE_MESSAGE, |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
319 | "message", message, |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | NULL |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | ); |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | } |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | |
|
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | PurpleMessage * |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
325 | pidgin_message_get_message(PidginMessage *message) { |
|
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
326 | g_return_val_if_fail(PIDGIN_IS_MESSAGE(message), NULL); |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | |
|
40526
c8cc1a4c4a02
Add support for message attachments
Gary Kramlich <grim@reaperworld.com>
parents:
39825
diff
changeset
|
328 | return message->message; |
|
39702
8102041c0288
Replace gtkconv->webview with a TalkatuHistory
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
329 | } |