1 Description: the perl fix¹ for bug #1009149 disallows the use
2 of XSRETURN_* macros in expressions, hence all of them have to
3 be rewritten. Thanks to Andreas Rönnquist for the heads up!
4 ¹ https://salsa.debian.org/perl-team/interpreter/perl/-/commit/c949a3d4176ec66493af1aa87c1dc64fc6127bb6
5 Author: Ricardo Mones <mones@debian.org>
6 Last-Updated: 2022-04-12
8 diff --git a/src/plugins/perl/perl_plugin.c b/src/plugins/perl/perl_plugin.c
9 index 1ac005e1..ee9e15f2 100644
10 --- a/src/plugins/perl/perl_plugin.c
11 +++ b/src/plugins/perl/perl_plugin.c
12 @@ -577,76 +577,182 @@ static XS(XS_ClawsMail_filter_init)
16 - msginfo->size ? XSRETURN_UV(msginfo->size) : XSRETURN_UNDEF;
17 + if (msginfo->size) {
18 + XSRETURN_UV(msginfo->size);
24 - msginfo->date ? XSRETURN_PV(msginfo->date) : XSRETURN_UNDEF;
25 + if (msginfo->date) {
26 + XSRETURN_PV(msginfo->date);
32 - msginfo->from ? XSRETURN_PV(msginfo->from) : XSRETURN_UNDEF;
33 + if (msginfo->from) {
34 + XSRETURN_PV(msginfo->from);
40 - msginfo->to ? XSRETURN_PV(msginfo->to) : XSRETURN_UNDEF;
42 + XSRETURN_PV(msginfo->to);
48 - msginfo->cc ? XSRETURN_PV(msginfo->cc) : XSRETURN_UNDEF;
50 + XSRETURN_PV(msginfo->cc);
56 - msginfo->newsgroups ? XSRETURN_PV(msginfo->newsgroups) : XSRETURN_UNDEF;
57 + if (msginfo->newsgroups) {
58 + XSRETURN_PV(msginfo->newsgroups);
64 - msginfo->subject ? XSRETURN_PV(msginfo->subject) : XSRETURN_UNDEF;
65 + if (msginfo->subject) {
66 + XSRETURN_PV(msginfo->subject);
72 - msginfo->msgid ? XSRETURN_PV(msginfo->msgid) : XSRETURN_UNDEF;
73 + if (msginfo->msgid) {
74 + XSRETURN_PV(msginfo->msgid);
80 - msginfo->inreplyto ? XSRETURN_PV(msginfo->inreplyto) : XSRETURN_UNDEF;
81 + if (msginfo->inreplyto) {
82 + XSRETURN_PV(msginfo->inreplyto);
88 - msginfo->xref ? XSRETURN_PV(msginfo->xref) : XSRETURN_UNDEF;
89 + if (msginfo->xref) {
90 + XSRETURN_PV(msginfo->xref);
96 xface = procmsg_msginfo_get_avatar(msginfo, AVATAR_XFACE);
97 - xface ? XSRETURN_PV(xface) : XSRETURN_UNDEF;
105 - (msginfo->extradata && msginfo->extradata->dispositionnotificationto) ?
106 - XSRETURN_PV(msginfo->extradata->dispositionnotificationto) : XSRETURN_UNDEF;
107 + if (msginfo->extradata && msginfo->extradata->dispositionnotificationto) {
108 + XSRETURN_PV(msginfo->extradata->dispositionnotificationto);
114 - (msginfo->extradata && msginfo->extradata->returnreceiptto) ?
115 - XSRETURN_PV(msginfo->extradata->returnreceiptto) : XSRETURN_UNDEF;
116 + if (msginfo->extradata && msginfo->extradata->returnreceiptto) {
117 + XSRETURN_PV(msginfo->extradata->returnreceiptto);
123 EXTEND(SP, g_slist_length(msginfo->references));
125 for(walk = msginfo->references; walk != NULL; walk = g_slist_next(walk))
126 XST_mPV(ii++,walk->data ? (gchar*) walk->data: "");
127 - ii ? XSRETURN(ii) : XSRETURN_UNDEF;
135 - msginfo->score ? XSRETURN_IV(msginfo->score) : XSRETURN_UNDEF;
136 + if (msginfo->score) {
137 + XSRETURN_IV(msginfo->score);
143 - msginfo->plaintext_file ?
144 - XSRETURN_PV(msginfo->plaintext_file) : XSRETURN_UNDEF;
145 + if (msginfo->plaintext_file) {
146 + XSRETURN_PV(msginfo->plaintext_file);
152 - msginfo->hidden ? XSRETURN_IV(msginfo->hidden) : XSRETURN_UNDEF;
153 + if (msginfo->hidden) {
154 + XSRETURN_IV(msginfo->hidden);
160 if((charp = procmsg_get_message_file_path(msginfo)) != NULL) {
161 strncpy2(buf,charp,sizeof(buf));
170 - (msginfo->extradata && msginfo->extradata->partial_recv) ?
171 - XSRETURN_PV(msginfo->extradata->partial_recv) : XSRETURN_UNDEF;
172 + if (msginfo->extradata && msginfo->extradata->partial_recv) {
173 + XSRETURN_PV(msginfo->extradata->partial_recv);
179 - msginfo->total_size ? XSRETURN_IV(msginfo->total_size) : XSRETURN_UNDEF;
180 + if (msginfo->total_size) {
181 + XSRETURN_IV(msginfo->total_size);
187 - (msginfo->extradata && msginfo->extradata->account_server) ?
188 - XSRETURN_PV(msginfo->extradata->account_server) : XSRETURN_UNDEF;
189 + if (msginfo->extradata && msginfo->extradata->account_server) {
190 + XSRETURN_PV(msginfo->extradata->account_server);
196 - (msginfo->extradata && msginfo->extradata->account_login) ?
197 - XSRETURN_PV(msginfo->extradata->account_login) : XSRETURN_UNDEF;
198 + if (msginfo->extradata && msginfo->extradata->account_login) {
199 + XSRETURN_PV(msginfo->extradata->account_login);
205 - msginfo->planned_download ?
206 - XSRETURN_IV(msginfo->planned_download) : XSRETURN_UNDEF;
207 + if (msginfo->planned_download) {
208 + XSRETURN_IV(msginfo->planned_download);
216 - if(manual_filtering)
217 + if(manual_filtering) {
225 g_warning("Perl plugin: wrong argument to ClawsMail::C::init");
227 @@ -664,8 +770,9 @@ static XS(XS_ClawsMail_open_mail_file)
230 file = procmsg_get_message_file_path(msginfo);
235 if((message_file = claws_fopen(file, "rb")) == NULL) {
236 FILE_OP_ERROR(file, "claws_fopen");
237 g_warning("Perl plugin: file open error in ClawsMail::C::open_mail_file");
238 @@ -718,8 +825,9 @@ static XS(XS_ClawsMail_get_next_header)
248 /* ClawsMail::C::get_next_body_line */
249 @@ -736,10 +844,12 @@ static XS(XS_ClawsMail_get_next_body_line)
250 g_warning("Perl plugin: message file not open. Use ClawsMail::C::open_message_file first");
253 - if(claws_fgets(buf, sizeof(buf), message_file) != NULL)
254 + if(claws_fgets(buf, sizeof(buf), message_file) != NULL) {
264 @@ -772,57 +882,65 @@ static XS(XS_ClawsMail_check_flag)
265 filter_log_write(LOG_MATCH,"marked");
273 if(MSG_IS_UNREAD(msginfo->flags)) {
274 filter_log_write(LOG_MATCH,"unread");
282 if(MSG_IS_DELETED(msginfo->flags)) {
283 filter_log_write(LOG_MATCH,"deleted");
291 if(MSG_IS_NEW(msginfo->flags)) {
292 filter_log_write(LOG_MATCH,"new");
300 if(MSG_IS_REPLIED(msginfo->flags)) {
301 filter_log_write(LOG_MATCH,"replied");
309 if(MSG_IS_FORWARDED(msginfo->flags)) {
310 filter_log_write(LOG_MATCH,"forwarded");
318 if(MSG_IS_LOCKED(msginfo->flags)) {
319 filter_log_write(LOG_MATCH,"locked");
327 if(MSG_IS_IGNORE_THREAD(msginfo->flags)) {
328 filter_log_write(LOG_MATCH,"ignore_thread");
336 g_warning("Perl plugin: unknown argument to ClawsMail::C::check_flag");
338 @@ -845,8 +963,9 @@ static XS(XS_ClawsMail_colorlabel)
339 filter_log_write(LOG_MATCH,"colorlabel");
348 /* ClawsMail::C::age_greater(int) */
349 @@ -866,8 +985,9 @@ static XS(XS_ClawsMail_age_greater)
350 filter_log_write(LOG_MATCH,"age_greater");
359 /* ClawsMail::C::age_lower(int) */
360 @@ -887,8 +1007,9 @@ static XS(XS_ClawsMail_age_lower)
361 filter_log_write(LOG_MATCH,"age_lower");
370 /* ClawsMail::C::tagged() */
371 @@ -900,7 +1021,12 @@ static XS(XS_ClawsMail_tagged)
375 - return msginfo->tags ? XSRETURN_YES : XSRETURN_NO;
376 + if (msginfo->tags) {
384 /* ClawsMail::C::get_tags() */
385 @@ -1032,10 +1158,12 @@ static XS(XS_ClawsMail_make_sure_folder_exists)
387 identifier = SvPV_nolen(ST(0));
388 item = folder_get_item_from_identifier(identifier);
400 @@ -1066,8 +1194,9 @@ static XS(XS_ClawsMail_addr_in_addressbook)
401 filter_log_write(LOG_MATCH,"addr_in_addressbook");
411 @@ -1348,8 +1477,9 @@ static XS(XS_ClawsMail_forward)
421 /* ClawsMail::C::redirect(int,char*) */
422 @@ -1373,8 +1503,9 @@ static XS(XS_ClawsMail_redirect)
423 account = account_find_from_id(account_id);
424 compose = compose_redirect(account, msginfo, TRUE);
426 - if (compose->account->protocol == A_NNTP)
427 + if (compose->account->protocol == A_NNTP) {
431 compose_entry_append(compose, dest, COMPOSE_TO, PREF_NONE);
433 @@ -1389,8 +1520,9 @@ static XS(XS_ClawsMail_redirect)
444 @@ -1472,8 +1604,9 @@ static XS(XS_ClawsMail_get_attribute_value)
445 attribute_value = get_attribute_value(addr,attr,bookname);
448 - if(attribute_value)
449 + if(attribute_value) {
450 XSRETURN_PV(attribute_value);