From f831f6573737fc4079219c3159b40fb964b8f1d7 Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Wed, 19 Jun 2019 06:43:10 +0200 Subject: Rename prof_message_t into ProfMessage --- src/event/server_events.c | 20 ++++++++++---------- src/event/server_events.h | 14 +++++++------- src/log.c | 8 ++++---- src/log.h | 8 ++++---- src/plugins/api.c | 2 +- src/ui/chatwin.c | 2 +- src/ui/mucwin.c | 2 +- src/ui/privwin.c | 2 +- src/ui/ui.h | 6 +++--- src/ui/window.c | 2 +- src/ui/window.h | 2 +- src/xmpp/message.c | 14 +++++++------- src/xmpp/message.h | 8 ++++---- tests/unittests/log/stub_log.c | 8 ++++---- tests/unittests/ui/stub_ui.c | 6 +++--- 15 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/event/server_events.c b/src/event/server_events.c index 60d2dbf9..7c65a89f 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -267,7 +267,7 @@ sv_ev_room_subject(const char *const room, const char *const nick, const char *c } void -sv_ev_room_history(prof_message_t *message) +sv_ev_room_history(ProfMessage *message) { ProfMucWin *mucwin = wins_get_muc(message->jid->barejid); if (mucwin) { @@ -289,7 +289,7 @@ sv_ev_room_history(prof_message_t *message) } void -sv_ev_room_message(prof_message_t *message) +sv_ev_room_message(ProfMessage *message) { ProfMucWin *mucwin = wins_get_muc(message->jid->barejid); if (!mucwin) { @@ -381,7 +381,7 @@ sv_ev_room_message(prof_message_t *message) } void -sv_ev_incoming_private_message(prof_message_t *message) +sv_ev_incoming_private_message(ProfMessage *message) { char *old_plain = message->plain; message->plain = plugins_pre_priv_message_display(message->jid->fulljid, message->plain); @@ -401,7 +401,7 @@ sv_ev_incoming_private_message(prof_message_t *message) } void -sv_ev_delayed_private_message(prof_message_t *message) +sv_ev_delayed_private_message(ProfMessage *message) { char *old_plain = message->plain; message->plain = plugins_pre_priv_message_display(message->jid->fulljid, message->plain); @@ -483,7 +483,7 @@ sv_ev_outgoing_carbon(char *barejid, char *message, char *pgp_message, gboolean #ifdef HAVE_LIBGPGME static void -_sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, prof_message_t *message) +_sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message) { message->plain = p_gpg_decrypt(message->encrypted); if (message->plain) { @@ -504,7 +504,7 @@ _sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, prof_message_t *mess #ifdef HAVE_LIBOTR static void -_sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, prof_message_t *message) +_sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message) { gboolean decrypted = FALSE; message->plain = otr_on_message_recv(message->jid->barejid, message->jid->resourcepart, message->body, &decrypted); @@ -528,7 +528,7 @@ _sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, prof_message_t *mess #ifdef HAVE_OMEMO static void -_sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, prof_message_t *message) +_sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message) { chatwin_incoming_msg(chatwin, message, new_win); chat_log_omemo_msg_in(message); @@ -537,7 +537,7 @@ _sv_ev_incoming_omemo(ProfChatWin *chatwin, gboolean new_win, prof_message_t *me #endif static void -_sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, prof_message_t *message) +_sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, ProfMessage *message) { message->plain = strdup(message->body); chatwin_incoming_msg(chatwin, message, new_win); @@ -546,7 +546,7 @@ _sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, prof_message_t *me } void -sv_ev_incoming_message(prof_message_t *message) +sv_ev_incoming_message(ProfMessage *message) { gboolean new_win = FALSE; ProfChatWin *chatwin = wins_get_chat(message->jid->barejid); @@ -689,7 +689,7 @@ sv_ev_incoming_message(prof_message_t *message) } void -sv_ev_incoming_carbon(prof_message_t *message) +sv_ev_incoming_carbon(ProfMessage *message) { gboolean new_win = FALSE; ProfChatWin *chatwin = wins_get_chat(message->jid->barejid); diff --git a/src/event/server_events.h b/src/event/server_events.h index f0e24e54..6687960b 100644 --- a/src/event/server_events.h +++ b/src/event/server_events.h @@ -46,11 +46,11 @@ void sv_ev_room_invite(jabber_invite_t invite_type, const char *const reason, const char *const password); void sv_ev_room_broadcast(const char *const room_jid, const char *const message); void sv_ev_room_subject(const char *const room, const char *const nick, const char *const subject); -void sv_ev_room_history(prof_message_t *message); -void sv_ev_room_message(prof_message_t *message); -void sv_ev_incoming_message(prof_message_t *message); -void sv_ev_incoming_private_message(prof_message_t *message); -void sv_ev_delayed_private_message(prof_message_t *message); +void sv_ev_room_history(ProfMessage *message); +void sv_ev_room_message(ProfMessage *message); +void sv_ev_incoming_message(ProfMessage *message); +void sv_ev_incoming_private_message(ProfMessage *message); +void sv_ev_delayed_private_message(ProfMessage *message); void sv_ev_typing(char *barejid, char *resource); void sv_ev_paused(char *barejid, char *resource); void sv_ev_inactive(char *barejid, char *resource); @@ -72,8 +72,8 @@ void sv_ev_room_occupent_kicked(const char *const room, const char *const nick, void sv_ev_room_banned(const char *const room, const char *const actor, const char *const reason); void sv_ev_room_occupent_banned(const char *const room, const char *const nick, const char *const actor, const char *const reason); -void sv_ev_outgoing_carbon(prof_message_t *message); -void sv_ev_incoming_carbon(prof_message_t *message); +void sv_ev_outgoing_carbon(ProfMessage *message); +void sv_ev_incoming_carbon(ProfMessage *message); void sv_ev_xmpp_stanza(const char *const msg); void sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean config_required, const char *const role, const char *const affiliation, const char *const actor, const char *const reason, diff --git a/src/log.c b/src/log.c index 732809bd..c1c46a75 100644 --- a/src/log.c +++ b/src/log.c @@ -329,7 +329,7 @@ chat_log_omemo_msg_out(const char *const barejid, const char *const msg) } void -chat_log_otr_msg_in(prof_message_t *message) +chat_log_otr_msg_in(ProfMessage *message) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = connection_get_fulljid(); @@ -346,7 +346,7 @@ chat_log_otr_msg_in(prof_message_t *message) } void -chat_log_pgp_msg_in(prof_message_t *message) +chat_log_pgp_msg_in(ProfMessage *message) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = connection_get_fulljid(); @@ -363,7 +363,7 @@ chat_log_pgp_msg_in(prof_message_t *message) } void -chat_log_omemo_msg_in(prof_message_t *message) +chat_log_omemo_msg_in(ProfMessage *message) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = connection_get_fulljid(); @@ -380,7 +380,7 @@ chat_log_omemo_msg_in(prof_message_t *message) } void -chat_log_msg_in(prof_message_t *message) +chat_log_msg_in(ProfMessage *message) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = connection_get_fulljid(); diff --git a/src/log.h b/src/log.h index e6bea8dc..09238602 100644 --- a/src/log.h +++ b/src/log.h @@ -75,10 +75,10 @@ void chat_log_otr_msg_out(const char *const barejid, const char *const msg); void chat_log_pgp_msg_out(const char *const barejid, const char *const msg); void chat_log_omemo_msg_out(const char *const barejid, const char *const msg); -void chat_log_msg_in(prof_message_t *message); -void chat_log_otr_msg_in(prof_message_t *message); -void chat_log_pgp_msg_in(prof_message_t *message); -void chat_log_omemo_msg_in(prof_message_t *message); +void chat_log_msg_in(ProfMessage *message); +void chat_log_otr_msg_in(ProfMessage *message); +void chat_log_pgp_msg_in(ProfMessage *message); +void chat_log_omemo_msg_in(ProfMessage *message); void chat_log_close(void); GSList* chat_log_get_previous(const gchar *const login, const gchar *const recipient); diff --git a/src/plugins/api.c b/src/plugins/api.c index 2761b254..30511443 100644 --- a/src/plugins/api.c +++ b/src/plugins/api.c @@ -473,7 +473,7 @@ api_settings_int_set(const char *const group, const char *const key, int value) void api_incoming_message(const char *const barejid, const char *const resource, const char *const plain) { - prof_message_t *message = message_init(); + ProfMessage *message = message_init(); message->jid = jid_create_from_bare_and_resource(barejid, resource); message->plain = strdup(plain); diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index f6c1097e..5a32b5ae 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -241,7 +241,7 @@ chatwin_recipient_gone(ProfChatWin *chatwin) } void -chatwin_incoming_msg(ProfChatWin *chatwin, prof_message_t *message, gboolean win_created) +chatwin_incoming_msg(ProfChatWin *chatwin, ProfMessage *message, gboolean win_created) { assert(chatwin != NULL); char *old_plain = message->plain; diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 119a0c7d..fcc529cd 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -524,7 +524,7 @@ mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *c } void -mucwin_incoming_msg(ProfMucWin *mucwin, prof_message_t *message, GSList *mentions, GList *triggers) +mucwin_incoming_msg(ProfMucWin *mucwin, ProfMessage *message, GSList *mentions, GList *triggers) { assert(mucwin != NULL); int flags = 0; diff --git a/src/ui/privwin.c b/src/ui/privwin.c index 8fc8400a..1ba3c0c2 100644 --- a/src/ui/privwin.c +++ b/src/ui/privwin.c @@ -43,7 +43,7 @@ #include "ui/window_list.h" void -privwin_incoming_msg(ProfPrivateWin *privatewin, prof_message_t *message) +privwin_incoming_msg(ProfPrivateWin *privatewin, ProfMessage *message) { assert(privatewin != NULL); diff --git a/src/ui/ui.h b/src/ui/ui.h index d64e4080..7c5bed89 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -120,7 +120,7 @@ gboolean ui_win_has_unsaved_form(int num); // Chat window ProfChatWin* chatwin_new(const char *const barejid); -void chatwin_incoming_msg(ProfChatWin *chatwin, prof_message_t *message, gboolean win_created); +void chatwin_incoming_msg(ProfChatWin *chatwin, ProfMessage *message, gboolean win_created); void chatwin_receipt_received(ProfChatWin *chatwin, const char *const id); void chatwin_recipient_gone(ProfChatWin *chatwin); void chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id, prof_enc_t enc_mode, @@ -159,7 +159,7 @@ void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char *const presence); void mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message); void mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *const id, prof_enc_t enc_mode); -void mucwin_incoming_msg(ProfMucWin *mucwin, prof_message_t *message, GSList *mentions, GList *triggers); +void mucwin_incoming_msg(ProfMucWin *mucwin, ProfMessage *message, GSList *mentions, GList *triggers); void mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject); void mucwin_requires_config(ProfMucWin *mucwin); void mucwin_info(ProfMucWin *mucwin); @@ -197,7 +197,7 @@ void mucwin_set_message_char(ProfMucWin *mucwin, const char *const ch); void mucwin_unset_message_char(ProfMucWin *mucwin); // MUC private chat window -void privwin_incoming_msg(ProfPrivateWin *privatewin, prof_message_t *message); +void privwin_incoming_msg(ProfPrivateWin *privatewin, ProfMessage *message); void privwin_outgoing_msg(ProfPrivateWin *privwin, const char *const message); void privwin_message_occupant_offline(ProfPrivateWin *privwin); diff --git a/src/ui/window.c b/src/ui/window.c index 410e5e97..93e5801c 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1044,7 +1044,7 @@ win_show_status_string(ProfWin *window, const char *const from, } void -win_print_incoming(ProfWin *window, const char *const from, prof_message_t *message) +win_print_incoming(ProfWin *window, const char *const from, ProfMessage *message) { char enc_char = '-'; int flags = NO_ME; diff --git a/src/ui/window.h b/src/ui/window.h index 09dd06bb..b1e78bd9 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -65,7 +65,7 @@ void win_println_them_message(ProfWin *window, char ch, int flags, const char *c void win_println_me_message(ProfWin *window, char ch, const char *const me, const char *const message, ...); void win_print_outgoing(ProfWin *window, const char ch, const char *const message, ...); -void win_print_incoming(ProfWin *window, const char *const from, prof_message_t *message); +void win_print_incoming(ProfWin *window, const char *const from, ProfMessage *message); void win_print_history(ProfWin *window, GDateTime *timestamp, const char *const message, ...); void win_print_http_upload(ProfWin *window, const char *const message, char *url); diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 19657da0..c100684e 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -179,10 +179,10 @@ message_handlers_init(void) pubsub_event_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, free, free); } -prof_message_t * +ProfMessage * message_init(void) { - prof_message_t *message = malloc(sizeof(prof_message_t)); + ProfMessage *message = malloc(sizeof(ProfMessage)); message->jid = NULL; message->id = NULL; @@ -196,7 +196,7 @@ message_init(void) } void -message_free(prof_message_t *message) +message_free(ProfMessage *message) { xmpp_ctx_t *ctx = connection_get_ctx(); if (message->jid) { @@ -796,7 +796,7 @@ _handle_groupchat(xmpp_stanza_t *const stanza) return; } - prof_message_t *message = message_init(); + ProfMessage *message = message_init(); message->jid = jid; message->id = strdup(id); @@ -898,7 +898,7 @@ static void _private_chat_handler(xmpp_stanza_t *const stanza) { // standard chat message, use jid without resource - prof_message_t *message = message_init(); + ProfMessage *message = message_init(); const gchar *from = xmpp_stanza_get_from(stanza); message->jid = jid_create(from); @@ -966,7 +966,7 @@ _handle_carbons(xmpp_stanza_t *const stanza) return TRUE; } - prof_message_t *message = message_init(); + ProfMessage *message = message_init(); // check omemo encryption #ifdef HAVE_OMEMO @@ -1054,7 +1054,7 @@ _handle_chat(xmpp_stanza_t *const stanza) } // standard chat message, use jid without resource - prof_message_t *message = message_init(); + ProfMessage *message = message_init(); message->jid = jid; message->timestamp = stanza_get_delay(stanza); diff --git a/src/xmpp/message.h b/src/xmpp/message.h index f4861378..7660e9a9 100644 --- a/src/xmpp/message.h +++ b/src/xmpp/message.h @@ -44,7 +44,7 @@ typedef enum { PROF_MSG_ENC_OMEMO } prof_enc_t; -typedef struct { +typedef struct prof_message_t { Jid *jid; char *id; /* The raw body from xmpp message, either plaintext or OTR encrypted text */ @@ -56,13 +56,13 @@ typedef struct { GDateTime *timestamp; prof_enc_t enc; gboolean trusted; -} prof_message_t; +} ProfMessage; typedef int(*ProfMessageCallback)(xmpp_stanza_t *const stanza, void *const userdata); typedef void(*ProfMessageFreeCallback)(void *userdata); -prof_message_t *message_init(void); -void message_free(prof_message_t *message); +ProfMessage *message_init(void); +void message_free(ProfMessage *message); void message_handlers_init(void); void message_handlers_clear(void); void message_pubsub_event_handler_add(const char *const node, ProfMessageCallback func, ProfMessageFreeCallback free_func, void *userdata); diff --git a/tests/unittests/log/stub_log.c b/tests/unittests/log/stub_log.c index fdbd4f31..14fc4d99 100644 --- a/tests/unittests/log/stub_log.c +++ b/tests/unittests/log/stub_log.c @@ -60,10 +60,10 @@ void chat_log_otr_msg_out(const char * const barejid, const char * const msg) {} void chat_log_pgp_msg_out(const char * const barejid, const char * const msg) {} void chat_log_omemo_msg_out(const char *const barejid, const char *const msg) {} -void chat_log_msg_in(prof_message_t *message) {} -void chat_log_otr_msg_in(prof_message_t *message) {} -void chat_log_pgp_msg_in(prof_message_t *message) {} -void chat_log_omemo_msg_in(prof_message_t *message) {} +void chat_log_msg_in(ProfMessage *message) {} +void chat_log_otr_msg_in(ProfMessage *message) {} +void chat_log_pgp_msg_in(ProfMessage *message) {} +void chat_log_omemo_msg_in(ProfMessage *message) {} void chat_log_close(void) {} GSList * chat_log_get_previous(const gchar * const login, diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index ecf1735c..a33904e0 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -152,10 +152,10 @@ void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activi } void ui_contact_typing(const char * const barejid, const char * const resource) {} -void chatwin_incoming_msg(ProfChatWin *chatwin, prof_message_t *message, gboolean win_created) {} +void chatwin_incoming_msg(ProfChatWin *chatwin, ProfMessage *message, gboolean win_created) {} void chatwin_receipt_received(ProfChatWin *chatwin, const char * const id) {} -void privwin_incoming_msg(ProfPrivateWin *privatewin, prof_message_t *message) {} +void privwin_incoming_msg(ProfPrivateWin *privatewin, ProfMessage *message) {} void ui_disconnected(void) {} void chatwin_recipient_gone(ProfChatWin *chatwin) {} @@ -190,7 +190,7 @@ void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char const char * const affiliation, const char * const actor, const char * const reason) {} void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char * const presence) {} void mucwin_history(ProfMucWin *mucwin, const char * const nick, GDateTime *timestamp, const char * const message) {} -void mucwin_incoming_msg(ProfMucWin *mucwin, prof_message_t *message, GSList *mentions, GList *triggers) {} +void mucwin_incoming_msg(ProfMucWin *mucwin, ProfMessage *message, GSList *mentions, GList *triggers) {} void mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *const id, prof_enc_t enc_mode) {} void mucwin_subject(ProfMucWin *mucwin, const char * const nick, const char * const subject) {} void mucwin_requires_config(ProfMucWin *mucwin) {} -- cgit 1.4.1-2-gfad0 akkartik.com> 2020-06-12 07:57:38 -0700 6513' href='/akkartik/mu/commit/html/062write-stream.subx.html?h=main&id=86351aafe218a7386f6578be3c4da3edcdcb0c98'>86351aaf ^
ec73ed12 ^
86351aaf ^





























































ec73ed12 ^
86351aaf ^

ec73ed12 ^
86351aaf ^










ec73ed12 ^
86351aaf ^
ec73ed12 ^
86351aaf ^



ec73ed12 ^
86351aaf ^
ec73ed12 ^
86351aaf ^




ec73ed12 ^
86351aaf ^
ec73ed12 ^
86351aaf ^



ec73ed12 ^

86351aaf ^
ec73ed12 ^
86351aaf ^





ec73ed12 ^
86351aaf ^
ec73ed12 ^
86351aaf ^








ec73ed12 ^
86351aaf ^
ec73ed12 ^
86351aaf ^



ec73ed12 ^
86351aaf ^
ec73ed12 ^
86351aaf ^




ec73ed12 ^
86351aaf ^
ec73ed12 ^
86351aaf ^




ec73ed12 ^

86351aaf ^
ec73ed12 ^
86351aaf ^





ec73ed12 ^
86351aaf ^
ec73ed12 ^
86351aaf ^



ec73ed12 ^

86351aaf ^
ec73ed12 ^
86351aaf ^





ec73ed12 ^
86351aaf ^
ec73ed12 ^
86351aaf ^

















d1c9392a ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317