Commit 433677f4 433677f4cf89692dc91cf1a4ee28316fecc8e805 by Sergey Poznyakoff

Add gettext markers

1 parent 0c89e510
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
53 #include <mailutils/iterator.h> 53 #include <mailutils/iterator.h>
54 #include <mailutils/argcv.h> 54 #include <mailutils/argcv.h>
55 #include <mailutils/tls.h> 55 #include <mailutils/tls.h>
56 #include <mailutils/nls.h>
56 57
57 /* For dbg purposes set to one to see different level of traffic. */ 58 /* For dbg purposes set to one to see different level of traffic. */
58 /* Print to stderr the command sent to the IMAP server. */ 59 /* Print to stderr the command sent to the IMAP server. */
...@@ -1923,7 +1924,7 @@ imap_fetch (f_imap_t f_imap) ...@@ -1923,7 +1924,7 @@ imap_fetch (f_imap_t f_imap)
1923 { 1924 {
1924 status = imap_rfc822_header (f_imap, &sp); 1925 status = imap_rfc822_header (f_imap, &sp);
1925 } 1926 }
1926 /* else mu_error ("not supported RFC822 option\n"); */ 1927 /* else mu_error (_("not supported RFC822 option")); */
1927 } 1928 }
1928 else 1929 else
1929 { 1930 {
...@@ -1934,7 +1935,7 @@ imap_fetch (f_imap_t f_imap) ...@@ -1934,7 +1935,7 @@ imap_fetch (f_imap_t f_imap)
1934 { 1935 {
1935 status = imap_uid (f_imap, &sp); 1936 status = imap_uid (f_imap, &sp);
1936 } 1937 }
1937 /* else mu_error ("not supported FETCH command\n"); */ 1938 /* else mu_error (_("not supported FETCH command")); */
1938 } 1939 }
1939 return status; 1940 return status;
1940 } 1941 }
...@@ -2222,8 +2223,14 @@ imap_parse (f_imap_t f_imap) ...@@ -2222,8 +2223,14 @@ imap_parse (f_imap_t f_imap)
2222 remainder = empty; 2223 remainder = empty;
2223 } 2224 }
2224 2225
2226 if (!tag)
2227 {
2228 /* Just in case */
2229 mu_error (_("No tag in response: %s %s"), response, remainder);
2230 status = MU_ERR_FAILURE;
2231 }
2225 /* Is the response untagged ? */ 2232 /* Is the response untagged ? */
2226 if (tag && tag[0] == '*') 2233 else if (tag[0] == '*')
2227 { 2234 {
2228 FOLDER_DEBUG2(folder, MU_DEBUG_PROT, "* %s %s\n", 2235 FOLDER_DEBUG2(folder, MU_DEBUG_PROT, "* %s %s\n",
2229 response, remainder); 2236 response, remainder);
...@@ -2246,7 +2253,7 @@ imap_parse (f_imap_t f_imap) ...@@ -2246,7 +2253,7 @@ imap_parse (f_imap_t f_imap)
2246 /* The human-readable text contains a special alert that 2253 /* The human-readable text contains a special alert that
2247 MUST be presented to the user in a fashion that calls 2254 MUST be presented to the user in a fashion that calls
2248 the user's attention to the message. */ 2255 the user's attention to the message. */
2249 mu_error ("ALERT: %s\n", (sp) ? sp : ""); 2256 mu_error (_("ALERT: %s"), (sp) ? sp : "");
2250 } 2257 }
2251 else if (strcasecmp (subtag, "BADCHARSET") == 0) 2258 else if (strcasecmp (subtag, "BADCHARSET") == 0)
2252 { 2259 {
...@@ -2255,7 +2262,7 @@ imap_parse (f_imap_t f_imap) ...@@ -2255,7 +2262,7 @@ imap_parse (f_imap_t f_imap)
2255 is not supported by this implementation. If the 2262 is not supported by this implementation. If the
2256 optional list of charsets is given, this lists the 2263 optional list of charsets is given, this lists the
2257 charsets that are supported by this implementation. */ 2264 charsets that are supported by this implementation. */
2258 mu_error ("BADCHARSET: %s\n", (sp) ? sp : ""); 2265 mu_error (_("BAD CHARSET: %s"), (sp) ? sp : "");
2259 } 2266 }
2260 else if (strcasecmp (subtag, "CAPABILITY") == 0) 2267 else if (strcasecmp (subtag, "CAPABILITY") == 0)
2261 { 2268 {
...@@ -2274,14 +2281,14 @@ imap_parse (f_imap_t f_imap) ...@@ -2274,14 +2281,14 @@ imap_parse (f_imap_t f_imap)
2274 mailbox name. This is a hint to the client that the 2281 mailbox name. This is a hint to the client that the
2275 operation can succeed if the SELECT or EXAMINE is 2282 operation can succeed if the SELECT or EXAMINE is
2276 reissued with the new mailbox name. */ 2283 reissued with the new mailbox name. */
2277 mu_error ("NEWNAME: %s\n", (sp) ? sp : ""); 2284 mu_error ("NEWNAME: %s", (sp) ? sp : "");
2278 } 2285 }
2279 else if (strcasecmp (subtag, "PARSE") == 0) 2286 else if (strcasecmp (subtag, "PARSE") == 0)
2280 { 2287 {
2281 /* The human-readable text represents an error in 2288 /* The human-readable text represents an error in
2282 parsing the [RFC-822] header or [MIME-IMB] headers 2289 parsing the [RFC-822] header or [MIME-IMB] headers
2283 of a message in the mailbox. */ 2290 of a message in the mailbox. */
2284 mu_error ("PARSE: %s\n", (sp) ? sp : ""); 2291 mu_error ("PARSE: %s", (sp) ? sp : "");
2285 } 2292 }
2286 else if (strcasecmp (subtag, "PERMANENTFLAGS") == 0) 2293 else if (strcasecmp (subtag, "PERMANENTFLAGS") == 0)
2287 { 2294 {
...@@ -2317,7 +2324,7 @@ imap_parse (f_imap_t f_imap) ...@@ -2317,7 +2324,7 @@ imap_parse (f_imap_t f_imap)
2317 other reason). This is a hint to the client that 2324 other reason). This is a hint to the client that
2318 the operation can succeed if the mailbox is first 2325 the operation can succeed if the mailbox is first
2319 created by the CREATE command. */ 2326 created by the CREATE command. */
2320 mu_error ("TRYCREATE: %s\n", (sp) ? sp : ""); 2327 mu_error ("TRYCREATE: %s", (sp) ? sp : "");
2321 } 2328 }
2322 else if (strcasecmp (subtag, "UIDNEXT") == 0) 2329 else if (strcasecmp (subtag, "UIDNEXT") == 0)
2323 { 2330 {
...@@ -2355,18 +2362,18 @@ imap_parse (f_imap_t f_imap) ...@@ -2355,18 +2362,18 @@ imap_parse (f_imap_t f_imap)
2355 { 2362 {
2356 /* Not sure why we would get an untagged ok...but we do... */ 2363 /* Not sure why we would get an untagged ok...but we do... */
2357 /* Still should we be verbose about is ? */ 2364 /* Still should we be verbose about is ? */
2358 mu_error ("Untagged OK: %s\n", remainder); 2365 mu_error (_("Untagged OK: %s"), remainder);
2359 } 2366 }
2360 } 2367 }
2361 else if (strcasecmp (response, "NO") == 0) 2368 else if (strcasecmp (response, "NO") == 0)
2362 { 2369 {
2363 /* This does not mean failure but rather a strong warning. */ 2370 /* This does not mean failure but rather a strong warning. */
2364 mu_error ("Untagged NO: %s\n", remainder); 2371 mu_error (_("Untagged NO: %s"), remainder);
2365 } 2372 }
2366 else if (strcasecmp (response, "BAD") == 0) 2373 else if (strcasecmp (response, "BAD") == 0)
2367 { 2374 {
2368 /* We're dead, protocol/syntax error. */ 2375 /* We're dead, protocol/syntax error. */
2369 mu_error ("Untagged BAD: %s\n", remainder); 2376 mu_error (_("Untagged BAD: %s"), remainder);
2370 } 2377 }
2371 else if (strcasecmp (response, "PREAUTH") == 0) 2378 else if (strcasecmp (response, "PREAUTH") == 0)
2372 { 2379 {
...@@ -2390,7 +2397,7 @@ imap_parse (f_imap_t f_imap) ...@@ -2390,7 +2397,7 @@ imap_parse (f_imap_t f_imap)
2390 { 2397 {
2391 f_imap->selected->messages_count = strtol (response, NULL, 10); 2398 f_imap->selected->messages_count = strtol (response, NULL, 10);
2392 } 2399 }
2393 else if (strcasecmp (remainder, "EXPUNGED") == 0) 2400 else if (strcasecmp (remainder, "EXPUNGE") == 0)
2394 { 2401 {
2395 unsigned int msgno = strtol (response, NULL, 10); 2402 unsigned int msgno = strtol (response, NULL, 10);
2396 status = imap_expunge (f_imap, msgno); 2403 status = imap_expunge (f_imap, msgno);
...@@ -2429,12 +2436,12 @@ imap_parse (f_imap_t f_imap) ...@@ -2429,12 +2436,12 @@ imap_parse (f_imap_t f_imap)
2429 else 2436 else
2430 { 2437 {
2431 /* Once again, check for something strange. */ 2438 /* Once again, check for something strange. */
2432 mu_error ("unknown untagged response: \"%s\" %s\n", 2439 mu_error (_("unknown untagged response: \"%s\" %s"),
2433 response, remainder); 2440 response, remainder);
2434 } 2441 }
2435 } 2442 }
2436 /* Continuation token ???. */ 2443 /* Continuation token ???. */
2437 else if (tag && tag[0] == '+') 2444 else if (tag[0] == '+')
2438 { 2445 {
2439 done = 1; 2446 done = 1;
2440 } 2447 }
...@@ -2463,7 +2470,8 @@ imap_parse (f_imap_t f_imap) ...@@ -2463,7 +2470,8 @@ imap_parse (f_imap_t f_imap)
2463 else /* NO and BAD */ 2470 else /* NO and BAD */
2464 { 2471 {
2465 status = EINVAL; 2472 status = EINVAL;
2466 mu_error ("NO/Bad Tagged: %s %s\n", response, remainder); 2473 mu_error (_("NO/Bad Tagged: %s %s %s"),
2474 tag, response, remainder);
2467 } 2475 }
2468 } 2476 }
2469 f_imap->ptr = f_imap->buffer; 2477 f_imap->ptr = f_imap->buffer;
......
...@@ -367,7 +367,7 @@ mbox_is_updated (mu_mailbox_t mailbox) ...@@ -367,7 +367,7 @@ mbox_is_updated (mu_mailbox_t mailbox)
367 { 367 {
368 mu_observable_notify (mailbox->observable, MU_EVT_MAILBOX_CORRUPT); 368 mu_observable_notify (mailbox->observable, MU_EVT_MAILBOX_CORRUPT);
369 /* And be verbose. ? */ 369 /* And be verbose. ? */
370 mu_error ("* BAD : Mailbox corrupted, shrank size\n"); 370 mu_error (_("* BAD : Mailbox corrupted, shrank in size"));
371 /* FIXME: should I crash. */ 371 /* FIXME: should I crash. */
372 return 0; 372 return 0;
373 } 373 }
...@@ -482,7 +482,7 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted) ...@@ -482,7 +482,7 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
482 { 482 {
483 if (tmpmboxname) 483 if (tmpmboxname)
484 free (tmpmboxname); 484 free (tmpmboxname);
485 mu_error ("Failed to create temporary file when expunging.\n"); 485 mu_error (_("Failed to create temporary file when expunging"));
486 return errno; 486 return errno;
487 } 487 }
488 488
...@@ -545,7 +545,7 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted) ...@@ -545,7 +545,7 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
545 mu_mailbox_destroy (&tmpmailbox); 545 mu_mailbox_destroy (&tmpmailbox);
546 remove (tmpmboxname); 546 remove (tmpmboxname);
547 free (tmpmboxname); 547 free (tmpmboxname);
548 mu_error ("Failed to grab the lock: %s\n", mu_strerror(status)); 548 mu_error (_("Failed to grab the lock: %s"), mu_strerror (status));
549 return status; 549 return status;
550 } 550 }
551 551
...@@ -597,8 +597,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted) ...@@ -597,8 +597,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
597 status = mbox_get_message (mailbox, i + 1, &msg); 597 status = mbox_get_message (mailbox, i + 1, &msg);
598 if (status != 0) 598 if (status != 0)
599 { 599 {
600 mu_error ("Error expunge:%d: %s", __LINE__, 600 mu_error (_("Error expunging:%d: %s"), __LINE__,
601 mu_strerror (status)); 601 mu_strerror (status));
602 goto bailout0; 602 goto bailout0;
603 } 603 }
604 } 604 }
...@@ -606,8 +606,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted) ...@@ -606,8 +606,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
606 &total, 1, (i == save_imapbase)); 606 &total, 1, (i == save_imapbase));
607 if (status != 0) 607 if (status != 0)
608 { 608 {
609 mu_error ("Error expunge:%d: %s", __LINE__, 609 mu_error (_("Error expunging:%d: %s"), __LINE__,
610 mu_strerror (status)); 610 mu_strerror (status));
611 goto bailout0; 611 goto bailout0;
612 } 612 }
613 /* Clear the dirty bits. */ 613 /* Clear the dirty bits. */
...@@ -629,8 +629,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted) ...@@ -629,8 +629,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
629 || (status = mu_stream_write (tmpmailbox->stream, buffer, n, 629 || (status = mu_stream_write (tmpmailbox->stream, buffer, n,
630 total, &n) != 0)) 630 total, &n) != 0))
631 { 631 {
632 mu_error ("Error expunge:%d: %s", __LINE__, 632 mu_error (_("Error expunging:%d: %s"), __LINE__,
633 mu_strerror (status)); 633 mu_strerror (status));
634 goto bailout0; 634 goto bailout0;
635 } 635 }
636 len -= n; 636 len -= n;
...@@ -641,8 +641,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted) ...@@ -641,8 +641,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
641 status = mu_stream_write (tmpmailbox->stream, "\n", 1, total, &n); 641 status = mu_stream_write (tmpmailbox->stream, "\n", 1, total, &n);
642 if (status != 0) 642 if (status != 0)
643 { 643 {
644 mu_error ("Error expunge:%d: %s", __LINE__, 644 mu_error (_("Error expunging:%d: %s"), __LINE__,
645 mu_strerror (status)); 645 mu_strerror (status));
646 goto bailout0; 646 goto bailout0;
647 } 647 }
648 total++; 648 total++;
...@@ -671,8 +671,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted) ...@@ -671,8 +671,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
671 total, &n); 671 total, &n);
672 if (status != 0) 672 if (status != 0)
673 { 673 {
674 mu_error ("Error expunge:%d: %s", __LINE__, 674 mu_error (_("Error expunging:%d: %s"), __LINE__,
675 mu_strerror (status)); 675 mu_strerror (status));
676 goto bailout0; 676 goto bailout0;
677 } 677 }
678 total += n; 678 total += n;
...@@ -682,8 +682,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted) ...@@ -682,8 +682,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
682 else if (len < 0) 682 else if (len < 0)
683 { 683 {
684 /* Corrupted mailbox. */ 684 /* Corrupted mailbox. */
685 mu_error ("Error expunge:%d: %s", __LINE__, 685 mu_error (_("Error expunging:%d: %s"), __LINE__,
686 mu_strerror (status)); 686 mu_strerror (status));
687 goto bailout0; 687 goto bailout0;
688 } 688 }
689 } 689 }
...@@ -703,8 +703,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted) ...@@ -703,8 +703,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
703 status = mu_stream_write (mailbox->stream, buffer, n, offset, &n); 703 status = mu_stream_write (mailbox->stream, buffer, n, offset, &n);
704 if (status != 0) 704 if (status != 0)
705 { 705 {
706 mu_error ("Error expunge:%d: %s\n", __LINE__, 706 mu_error (_("Error expunging:%d: %s"), __LINE__,
707 mu_strerror (status)); 707 mu_strerror (status));
708 goto bailout; 708 goto bailout;
709 } 709 }
710 off += n; 710 off += n;
...@@ -717,8 +717,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted) ...@@ -717,8 +717,8 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
717 status = mu_stream_truncate (mailbox->stream, total + marker); 717 status = mu_stream_truncate (mailbox->stream, total + marker);
718 if (status != 0) 718 if (status != 0)
719 { 719 {
720 mu_error ("Error expunging:%d: %s\n", __LINE__, 720 mu_error (_("Error expunging:%d: %s"), __LINE__,
721 mu_strerror (status)); 721 mu_strerror (status));
722 goto bailout; 722 goto bailout;
723 } 723 }
724 724
......