Changeset 3301

Show
Ignore:
Timestamp:
01/27/08 18:09:53
Author:
pvanhoof
Message:

2008-01-27 Philip Van Hoof <pvanhoof@gnome.org>

        • Various code improvements
        • Merged camel-lite with upstream camel revision 8428
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3300 r3301  
    22 
    33        * Various code improvements  
     4        * Merged camel-lite with upstream camel revision 8428 
    45 
    562008-01-26  Philip Van Hoof <pvanhoof@gnome.org> 
  • trunk/libtinymail-camel/camel-lite/ChangeLog

    r3246 r3301  
    22this version, and the other way around). Changes to camel-lite that are 
    33related to Tinymail go into ../../ChangeLog 
     4 
     52008-01-27  Philip Van Hoof <pvanhoof@gnome.org> 
     6 
     7        * Merged with Camel upstream rev. 8428 
    48 
    592008-01-12  Philip Van Hoof <pvanhoof@gnome.org> 
  • trunk/libtinymail-camel/camel-lite/camel/camel-filter-driver.c

    r3200 r3301  
    3232#include <time.h> 
    3333 
     34#include <glib.h> 
     35#include <glib/gstdio.h> 
     36#include <glib/gi18n-lib.h> 
     37 
    3438#ifndef G_OS_WIN32 
    3539#include <sys/wait.h> 
    3640#endif 
    37  
    38 #include <glib.h> 
    39 #include <glib/gstdio.h> 
    40 #include <glib/gi18n-lib.h> 
    4141 
    4242#include <libedataserver/e-sexp.h> 
  • trunk/libtinymail-camel/camel-lite/camel/camel-filter-search.c

    r2950 r3301  
    3939#include <unistd.h> 
    4040 
     41#include <glib.h> 
     42#include <glib/gi18n-lib.h> 
     43 
    4144#ifndef G_OS_WIN32 
    4245#include <sys/wait.h> 
    4346#endif 
    44  
    45 #include <glib.h> 
    46 #include <glib/gi18n-lib.h> 
    4747 
    4848#include <libedataserver/e-iconv.h> 
     
    5959#include "camel-stream-fs.h" 
    6060#include "camel-stream-mem.h" 
     61#include "camel-string-utils.h" 
    6162#include "camel-url.h" 
    6263 
     
    9495static ESExpResult *get_size (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); 
    9596static ESExpResult *pipe_message (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); 
     97 
     98#ifdef NON_TINYMAIL_FEATURES 
    9699static ESExpResult *junk_test (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); 
     100#endif 
    97101 
    98102/* builtin functions */ 
     
    123127        { "get-size",           (ESExpFunc *) get_size,           0 }, 
    124128        { "pipe-message",       (ESExpFunc *) pipe_message,       0 }, 
     129#ifdef NON_TINYMAIL_FEATURES 
    125130        { "junk-test",          (ESExpFunc *) junk_test,          0 }, 
     131#endif 
    126132}; 
    127133 
     
    645651} 
    646652 
     653#ifdef NON_TINYMAIL_FEATURES 
    647654static ESExpResult * 
    648655junk_test (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) 
     
    650657        ESExpResult *r; 
    651658        gboolean retval = FALSE; 
    652  
     659         
     660        d(printf("doing junk test for message from '%s'\n", camel_message_info_from (fms->info))); 
    653661        if (fms->session->junk_plugin != NULL) { 
    654                 retval = camel_junk_plugin_check_junk (fms->session->junk_plugin, camel_filter_search_get_message (fms, f)); 
     662                CamelMessageInfo *info = fms->info; 
     663                const GHashTable *ht = camel_session_get_junk_headers (fms->session); 
     664                struct _camel_header_param *node = ((CamelMessageInfoBase *)info)->headers; 
     665 
     666                while (node && !retval) { 
     667                        if (node->name) { 
     668                                char *value = (char *) g_hash_table_lookup ((GHashTable *) ht, node->name); 
     669                                d(printf("JunkCheckMatch: %s %s %s\n", node->name, node->value, value)); 
     670                                if (value) 
     671                                        retval = camel_strstrcase(node->value, value) != NULL; 
     672                 
     673                        } 
     674                        node = node->next; 
     675                } 
     676                if (camel_debug ("junk")) 
     677                        printf("filtered based on junk header ? %d\n", retval); 
     678                if (!retval) { 
     679                        retval = camel_session_lookup_addressbook (fms->session, camel_message_info_from (info)) != TRUE; 
     680                        if (camel_debug ("junk")) 
     681                                printf("Sender '%s' in book? %d\n", camel_message_info_from (info), !retval); 
     682                         
     683                        if (retval) /* Not in book. Could be spam. So check for it*/ { 
     684                                d(printf("filtering message\n")); 
     685                                retval = camel_junk_plugin_check_junk (fms->session->junk_plugin, camel_filter_search_get_message (fms, f)); 
     686                        } 
     687                } 
    655688 
    656689                if (camel_debug ("junk")) 
     
    663696        return r; 
    664697} 
     698#endif 
    665699 
    666700/** 
  • trunk/libtinymail-camel/camel-lite/camel/camel-folder-summary.c

    r3287 r3301  
    25722572                camel_flag_list_free(&mi->user_flags); 
    25732573                camel_tag_list_free(&mi->user_tags); 
     2574                if (mi->headers) 
     2575                        camel_header_param_list_free (mi->headers); 
    25742576#endif 
    25752577 
  • trunk/libtinymail-camel/camel-lite/camel/camel-folder-summary.h

    r3287 r3301  
    161161        /* tree of content description - NULL if it is not available */ 
    162162        CamelMessageContentInfo *content;  /* 4 bytes */ 
     163#ifdef NON_TINYMAIL_FEATURES 
     164        struct _camel_header_param *headers; 
     165#endif 
    163166        CamelSummaryMessageID message_id;  /* 8 bytes */ 
    164167 
  • trunk/libtinymail-camel/camel-lite/camel/camel-gpg-context.c

    r2950 r3301  
    4343#include <sys/types.h> 
    4444 
     45#include <glib.h> 
     46#include <glib/gi18n-lib.h> 
     47#include <glib/gstdio.h> 
     48 
    4549#ifndef G_OS_WIN32 
    4650#include <sys/ioctl.h> 
     
    4953#include <termios.h> 
    5054#endif 
    51  
    52 #include <glib.h> 
    53 #include <glib/gi18n-lib.h> 
    54 #include <glib/gstdio.h> 
    5555 
    5656#include <libedataserver/e-iconv.h> 
     
    824824 
    825825                if (!strncmp ((char *) status, "passphrase.pin.ask", 18)) { 
    826                         prompt = g_strdup_printf (_("You need a PIN to unlock the key for your\n" 
    827                                                     "SmartCard: \"%s\""), name); 
     826                        prompt = g_markup_printf_escaped ( 
     827                                _("You need a PIN to unlock the key for your\n" 
     828                                  "SmartCard: \"%s\""), name); 
    828829                } else if (!strncmp ((char *) status, "passphrase.enter", 16)) { 
    829                         prompt = g_strdup_printf (_("You need a passphrase to unlock the key for\n" 
    830                                                     "user: \"%s\""), name); 
     830                        prompt = g_markup_printf_escaped ( 
     831                                _("You need a passphrase to unlock the key for\n" 
     832                                  "user: \"%s\""), name); 
    831833                } else { 
    832834                        next_token ((char *) status, &prompt); 
  • trunk/libtinymail-camel/camel-lite/camel/camel-mime-utils.c

    r3274 r3301  
    13951395 
    13961396        while (inlen) { 
    1397                 size_t convlen, proclen; 
     1397                ssize_t convlen, proclen; 
    13981398                int i; 
    13991399 
     
    14261426                                        convlen += 3; 
    14271427                        } 
     1428                         
    14281429                        if (proclen >= 0 && proclen < i && convlen < (75 - strlen("=?utf-8?q?\?="))) 
    14291430                                proclen = i; 
     1431                         
    14301432                        /* well, we probably have broken utf8, just copy it anyway what the heck */ 
    14311433                        if (proclen == -1) { 
     
    14331435                                proclen = inlen; 
    14341436                        } 
     1437                         
    14351438                        memcpy(out, inptr, proclen); 
    14361439                        inptr += proclen; 
  • trunk/libtinymail-camel/camel-lite/camel/camel-net-utils.c

    r3119 r3301  
    3030#include <stdio.h> 
    3131 
     32#include <glib.h> 
     33#include <glib/gi18n-lib.h> 
     34 
    3235#ifndef G_OS_WIN32 
    3336#include <sys/poll.h> 
     
    3538 
    3639#include <string.h> 
    37  
    38 #include <glib.h> 
    39 #include <glib/gi18n-lib.h> 
    4040 
    4141#include <libedataserver/e-msgport.h> 
  • trunk/libtinymail-camel/camel-lite/camel/camel-private.h

    r3239 r3301  
    100100 
    101101        GHashTable *thread_msg_op; 
     102        GHashTable *junk_headers; 
     103         
    102104}; 
    103105 
  • trunk/libtinymail-camel/camel-lite/camel/camel-session.c

    r2950 r3301  
    8080        session->priv->thread_active = g_hash_table_new(NULL, NULL); 
    8181        session->priv->thread_pool = NULL; 
     82        session->priv->junk_headers = NULL; 
    8283} 
    8384 
     
    100101        g_mutex_free(session->priv->lock); 
    101102        g_mutex_free(session->priv->thread_lock); 
    102  
     103        if (session->priv->junk_headers) { 
     104                g_hash_table_remove_all (session->priv->junk_headers); 
     105                g_hash_table_destroy (session->priv->junk_headers); 
     106        } 
    103107        g_free(session->priv); 
    104108} 
     
    433437} 
    434438 
     439gboolean 
     440camel_session_lookup_addressbook (CamelSession *session, const char *name) 
     441{ 
     442        g_return_val_if_fail (CAMEL_IS_SESSION (session), FALSE); 
     443        g_return_val_if_fail (name != NULL, FALSE); 
     444        return CS_CLASS (session)->lookup_addressbook (session, name); 
     445} 
     446 
    435447/** 
    436448 * camel_session_alert_user_with_id: 
     
    472484} 
    473485 
     486/** 
     487 * camel_session_build_password_prompt: 
     488 * @type: account type (e.g. "IMAP") 
     489 * @user: user name for the account 
     490 * @host: host name for the account 
     491 * 
     492 * Constructs a localized password prompt from @type, @user and @host, 
     493 * suitable for passing to camel_session_get_password().  The resulting 
     494 * string contains markup tags.  Use g_free() to free it. 
     495 * 
     496 * Returns: a newly-allocated password prompt string 
     497 **/ 
     498char * 
     499camel_session_build_password_prompt (const char *type, 
     500                                     const char *user, 
     501                                     const char *host) 
     502{ 
     503        char *user_markup; 
     504        char *host_markup; 
     505        char *prompt; 
     506 
     507        g_return_val_if_fail (type != NULL, NULL); 
     508        g_return_val_if_fail (user != NULL, NULL); 
     509        g_return_val_if_fail (host != NULL, NULL); 
     510 
     511        /* Add bold tags to the "user" and "host" strings.  We use 
     512         * separate strings here to avoid putting markup tags in the 
     513         * translatable string below. */ 
     514        user_markup = g_markup_printf_escaped ("<b>%s</b>", user); 
     515        host_markup = g_markup_printf_escaped ("<b>%s</b>", host); 
     516 
     517        /* Translators: The first argument is the account type 
     518         * (e.g. "IMAP"), the second is the user name, and the 
     519         * third is the host name. */ 
     520        prompt = g_strdup_printf ( 
     521                _("Please enter the %s password for %s on host %s."), 
     522                type, user_markup, host_markup); 
     523 
     524        g_free (user_markup); 
     525        g_free (host_markup); 
     526 
     527        return prompt; 
     528} 
    474529 
    475530/** 
     
    747802        session->network_state = network_state; 
    748803} 
     804 
     805void 
     806camel_session_set_junk_headers (CamelSession *session, const char **headers, const char **values, int len) 
     807{ 
     808        int i; 
     809 
     810        if (session->priv->junk_headers) { 
     811                g_hash_table_remove_all (session->priv->junk_headers); 
     812                g_hash_table_destroy (session->priv->junk_headers); 
     813        } 
     814 
     815        session->priv->junk_headers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); 
     816 
     817        for (i=0; i<len; i++) { 
     818                g_hash_table_insert (session->priv->junk_headers, g_strdup (headers[i]), g_strdup(values[i])); 
     819        } 
     820} 
     821 
     822const GHashTable * 
     823camel_session_get_junk_headers (CamelSession *session) 
     824{ 
     825        return session->priv->junk_headers; 
     826} 
  • trunk/libtinymail-camel/camel-lite/camel/camel-session.h

    r2950 r3301  
    110110        void (*thread_wait)(CamelSession *session, int id); 
    111111        void (*thread_status)(CamelSession *session, CamelSessionThreadMsg *msg, const char *text, int pc); 
     112        gboolean (*lookup_addressbook) (CamelSession *session, const char *name); 
    112113} CamelSessionClass; 
    113114 
     
    169170                                                     CamelService *service); 
    170171 
     172char *             camel_session_build_password_prompt 
     173                                                    (const char *type, 
     174                                                     const char *user, 
     175                                                     const char *host); 
     176 
    171177gboolean           camel_session_is_online          (CamelSession *session); 
    172178void               camel_session_set_online         (CamelSession *session, 
     
    206212gboolean camel_session_get_network_state (CamelSession *session); 
    207213void camel_session_set_network_state (CamelSession *session, gboolean network_state); 
     214const GHashTable * camel_session_get_junk_headers (CamelSession *session); 
     215void camel_session_set_junk_headers (CamelSession *session, const char **headers, const char **values, int len); 
     216gboolean camel_session_lookup_addressbook (CamelSession *session, const char *name); 
    208217 
    209218G_END_DECLS 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c

    r3299 r3301  
    21662166        } 
    21672167 
    2168         imap_uid_array_free (src); 
    2169         imap_uid_array_free (dest); 
     2168        if (src) 
     2169                imap_uid_array_free (src); 
     2170        if (dest) 
     2171                imap_uid_array_free (dest); 
    21702172 lose: 
    21712173        g_warning ("Bad COPYUID response from server"); 
     
    30463048 
    30473049        return; 
     3050} 
     3051 
     3052#endif 
     3053 
     3054 
     3055#ifdef NON_TINYMAIL_FEATURES 
     3056 
     3057struct _junk_data { 
     3058        GData *data; 
     3059        CamelMessageInfoBase *mi; 
     3060}; 
     3061 
     3062static void 
     3063construct_junk_headers (char *header, char *value, struct _junk_data *jdata) 
     3064{ 
     3065        char *bs, *es, *flag=NULL; 
     3066        char *bdata = g_datalist_get_data (&(jdata->data), "BODY_PART_DATA"); 
     3067        struct _camel_header_param *node; 
     3068 
     3069        /* FIXME: This can be written in a much clever way. 
     3070        * We can create HEADERS file or carry all headers till filtering so 
     3071        * that header based filtering can be much faster. But all that later. */ 
     3072        bs = camel_strstrcase (bdata ? bdata:"", header); 
     3073        if (bs) { 
     3074                bs += strlen(header); 
     3075                bs = strchr (bs, ':'); 
     3076                if (bs) { 
     3077                        bs++; 
     3078                        while (*bs == ' ') 
     3079                                bs++; 
     3080                        es = strchr (bs, '\n'); 
     3081                        if (es) 
     3082                                flag = g_strndup (bs, es-bs); 
     3083                        else 
     3084                                bs = NULL; 
     3085                } 
     3086 
     3087        } 
     3088 
     3089 
     3090        if (bs) { 
     3091                node = g_new (struct _camel_header_param, 1); 
     3092                node->name = g_strdup (header); 
     3093                node->value = flag; 
     3094                node->next = jdata->mi->headers; 
     3095                jdata->mi->headers = node; 
     3096        } 
    30483097} 
    30493098 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c

    r3280 r3301  
    17171717 
    17181718                if (!service->url->passwd) { 
    1719                         char *prompt; 
    1720  
    1721                         prompt = g_strdup_printf (_("%sPlease enter the IMAP " 
    1722                                 "password for %s@%s"), 
    1723                                 errbuf ? errbuf : "", 
    1724                                 service->url->user, 
    1725                                 service->url->host); 
    1726  
    1727                         service->url->passwd = 
    1728                                 camel_session_get_password (session, service, auth_domain, 
    1729                                         prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex); 
    1730                         g_free (prompt); 
     1719                        char *base_prompt; 
     1720                        char *full_prompt; 
     1721 
     1722                        base_prompt = camel_session_build_password_prompt ( 
     1723                                "IMAP", service->url->user, service->url->host); 
     1724 
     1725                        if (errbuf != NULL) 
     1726                                full_prompt = g_strconcat (errbuf, base_prompt, NULL); 
     1727                        else 
     1728                                full_prompt = g_strdup (base_prompt); 
     1729 
     1730                        service->url->passwd = camel_session_get_password ( 
     1731                                session, service, auth_domain, full_prompt, 
     1732                                "password", CAMEL_SESSION_PASSWORD_SECRET, ex); 
     1733 
     1734                        g_free (base_prompt); 
     1735                        g_free (full_prompt); 
    17311736                        g_free (errbuf); 
    17321737                        errbuf = NULL; 
     
    17841789                                return FALSE; 
    17851790 
    1786                         errbuf = g_strdup_printf (_("Unable to authenticate " 
     1791                        errbuf = g_markup_escaped_text ( 
     1792                                _("Unable to authenticate " 
    17871793                                "to IMAP server.\n%s\n\n"), 
    17881794                                camel_exception_get_description (ex)); 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap4/camel-imap4-store.c

    r2950 r3301  
    453453        if ((!mech || (mech && mech->need_password)) && !service->url->passwd) { 
    454454                guint32 flags = CAMEL_SESSION_PASSWORD_SECRET; 
    455                 char *prompt; 
     455                char *base_prompt; 
     456                char *full_prompt; 
    456457 
    457458                if (reprompt) 
    458459                        flags |= CAMEL_SESSION_PASSWORD_REPROMPT; 
    459460 
    460                 prompt = g_strdup_printf (_("%sPlease enter the IMAP password for %s on host %s"), 
    461                                           errmsg ? errmsg : "", 
    462                                           service->url->user, 
    463                                           service->url->host); 
    464  
    465                 service->url->passwd = camel_session_get_password (session, service, NULL, prompt, "password", flags, ex); 
    466  
    467                 g_free (prompt); 
     461                base_prompt = camel_session_build_password_prompt ( 
     462                        "IMAP", service->url->user, service->url->host); 
     463 
     464                if (errmsg != NULL) 
     465                        full_prompt = g_strconcat (errmsg, base_prompt, NULL); 
     466                else 
     467                        full_prompt = g_strdup (full_prompt); 
     468 
     469                service->url->passwd = camel_session_get_password ( 
     470                        session, service, NULL, full_prompt, 
     471                        "password", flags, ex); 
     472 
     473                g_free (base_prompt); 
     474                g_free (full_prompt); 
    468475 
    469476                if (!service->url->passwd) 
     
    534541                while (imap4_try_authenticate (engine, reprompt, errmsg, &lex)) { 
    535542                        g_free (errmsg); 
    536                         errmsg = g_strdup (lex.desc); 
     543                        errmsg = g_markup_escape_text (lex.desc, -1); 
    537544                        camel_exception_clear (&lex); 
    538545                        g_free (service->url->passwd); 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imapp/camel-imapp-store.c

    r2950 r3301  
    358358{ 
    359359        if (((CamelService *)store)->url->passwd == NULL) { 
    360                 char *prompt; 
     360                char *base_prompt; 
     361                char *full_prompt; 
    361362                CamelException ex; 
    362363 
    363364                camel_exception_init(&ex); 
    364365 
    365                 prompt = g_strdup_printf (_("%sPlease enter the IMAP password for %s@%s"), 
    366                                           store->login_error?store->login_error:"", 
    367                                           ((CamelService *)store)->url->user, 
    368                                           ((CamelService *)store)->url->host); 
    369                 ((CamelService *)store)->url->passwd = camel_session_get_password(camel_service_get_session((CamelService *)store), 
    370                                                                                   (CamelService *)store, NULL, 
    371                                                                                   prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, &ex); 
    372                 g_free (prompt); 
     366                base_prompt = camel_session_build_password_prompt ( 
     367                        "IMAP", ((CamelService *) store)->url->user, 
     368                        ((CamelService *) store)->url->host); 
     369 
     370                if (store->login_error != NULL) 
     371                        full_prompt = g_strconcat (store->login_error, base_prompt, NULL); 
     372                else 
     373                        full_prompt = g_strdup (base_prompt); 
     374 
     375                ((CamelService *)store)->url->passwd = camel_session_get_password ( 
     376                        camel_service_get_session ((CamelService *) store), 
     377                        (CamelService *) store, NULL, full_prompt, "password", 
     378                        CAMEL_SESSION_PASSWORD_SECRET, &ex); 
     379 
     380                g_free (base_prompt); 
     381                g_free (full_prompt); 
    373382                if (camel_exception_is_set(&ex)) 
    374383                        camel_exception_throw_ex(&ex); 
     
    439448                                switch (e->id) { 
    440449                                case CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE: 
    441                                         store->login_error = g_strdup_printf("%s\n\n", e->desc); 
     450                                        store->login_error = g_markup_printf_escaped("%s\n\n", e->desc); 
    442451                                        camel_session_forget_password(service->session, service, NULL, "password", ex); 
    443452                                        camel_url_set_passwd(service->url, NULL); 
  • trunk/libtinymail-camel/camel-lite/camel/providers/nntp/camel-nntp-auth.c

    r2950 r3301  
    4444                gchar *prompt; 
    4545 
    46                 prompt = g_strdup_printf (_("Please enter the NNTP password for %s@%s"), 
    47                                           service->url->user, service->url->host); 
    48                 service->url->passwd = 
    49                         camel_session_get_password (session, prompt, 
    50                                                     TRUE, service, "password", ex); 
     46                prompt = camel_session_build_password_prompt ( 
     47                        "NNTP", service->url->user, service->url->host); 
     48 
     49                service->url->passwd = camel_session_get_password ( 
     50                        session, prompt, TRUE, service, "password", ex); 
     51 
    5152                g_free (prompt); 
    5253 
  • trunk/libtinymail-camel/camel-lite/camel/providers/nntp/camel-nntp-store.c

    r2967 r3301  
    11601160                char *prompt, *base; 
    11611161        retry: 
    1162                 base = g_strdup_printf (_("Please enter the NNTP password for %s@%s"), 
    1163                                         service->url->user, 
    1164                                         service->url->host); 
     1162                base = camel_session_build_password_prompt ( 
     1163                        "NNTP", service->url->user, service->url->host); 
    11651164                if (line) { 
    1166                         char *top = g_strdup_printf(_("Cannot authenticate to server: %s"), line); 
     1165                        char *top = g_markup_printf_escaped ( 
     1166                                _("Cannot authenticate to server: %s"), line); 
    11671167 
    11681168                        prompt = g_strdup_printf("%s\n\n%s", top, base); 
  • trunk/libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c

    r3280 r3301  
    729729 
    730730        if (!service->url->passwd) { 
    731                 char *prompt; 
     731                char *base_prompt; 
     732                char *full_prompt; 
    732733                guint32 flags = CAMEL_SESSION_PASSWORD_SECRET; 
    733734 
     
    735736                        flags |= CAMEL_SESSION_PASSWORD_REPROMPT; 
    736737 
    737                 prompt = g_strdup_printf (_("%sPlease enter the POP password for %s on host %s"), 
    738                                           errmsg ? errmsg : "", 
    739                                           service->url->user, 
    740                                           service->url->host); 
    741                 service->url->passwd = camel_session_get_password (camel_service_get_session (service), service, NULL, 
    742                                                                    prompt, "password", flags, ex); 
    743                 g_free (prompt); 
     738                base_prompt = camel_session_build_password_prompt ( 
     739                        "POP", service->url->user, service->url->host); 
     740 
     741                if (errmsg != NULL) 
     742                        full_prompt = g_strconcat (errmsg, base_prompt, NULL); 
     743                else 
     744                        full_prompt = g_strdup (base_prompt); 
     745 
     746                service->url->passwd = camel_session_get_password ( 
     747                        camel_service_get_session (service), service, 
     748                        NULL, full_prompt, "password", flags, ex); 
     749 
     750                g_free (base_prompt); 
     751                g_free (full_prompt); 
    744752                if (!service->url->passwd) 
    745753                        return FALSE; 
     
    890898                /* we only re-prompt if we failed to authenticate, any other error and we just abort */ 
    891899                if (status == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE) { 
    892                         errbuf = g_strdup_printf ("%s\n\n", camel_exception_get_description (ex)); 
     900                        errbuf = g_markup_printf_escaped ("%s\n\n", camel_exception_get_description (ex)); 
    893901                        g_free (service->url->passwd); 
    894902                        service->url->passwd = NULL; 
  • trunk/libtinymail-camel/camel-lite/camel/providers/smtp/camel-smtp-transport.c

    r3239 r3301  
    549549 
    550550                        if (!service->url->passwd) { 
    551                                 char *prompt; 
    552  
    553                                 prompt = g_strdup_printf (_("%sPlease enter the SMTP password for %s on host %s"), 
    554                                                           errbuf ? errbuf : "", service->url->user, 
    555                                                           service->url->host); 
    556  
    557                                 service->url->passwd = camel_session_get_password (session, service, NULL, 
    558                                                 prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex); 
    559  
    560                                 g_free (prompt); 
     551                                char *base_prompt; 
     552                                char *full_prompt; 
     553 
     554                                base_prompt = camel_session_build_password_prompt ( 
     555                                        "SMTP", service->url->user, service->url->host); 
     556 
     557                                if (errbuf != NULL) 
     558                                        full_prompt = g_strconcat (errbuf, base_prompt, NULL); 
     559                                else 
     560                                        full_prompt = g_strdup (base_prompt); 
     561 
     562                                service->url->passwd = camel_session_get_password ( 
     563                                        session, service, NULL, full_prompt, 
     564                                        "password", CAMEL_SESSION_PASSWORD_SECRET, ex); 
     565 
     566                                g_free (base_prompt); 
     567                                g_free (full_prompt); 
    561568                                g_free (errbuf); 
    562569                                errbuf = NULL; 
     
    570577                        authenticated = smtp_auth (transport, authtype->authproto, ex); 
    571578                        if (!authenticated) { 
    572                                 errbuf = g_strdup_printf (_("Unable to authenticate " 
    573                                                             "to SMTP server.\n%s\n\n"), 
    574                                                           camel_exception_get_description (ex)); 
     579                                errbuf = g_markup_printf_escaped ( 
     580                                        _("Unable to authenticate " 
     581                                          "to SMTP server.\n%s\n\n"), 
     582                                        camel_exception_get_description (ex)); 
    575583                                camel_exception_clear (ex); 
    576584                        }