/[mailutils]/mailutils/mail/util.c
ViewVC logotype

Diff of /mailutils/mail/util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.59 by gray, Sat Sep 20 15:36:25 2003 UTC revision 1.60 by gray, Sun Sep 21 15:37:08 2003 UTC
# Line 1308  util_run_cached_commands (list_t *list) Line 1308  util_run_cached_commands (list_t *list)
1308    list_do (*list, _run_and_free, NULL);    list_do (*list, _run_and_free, NULL);
1309    list_destroy (list);    list_destroy (list);
1310  }  }
1311    
1312    void
1313    util_rfc2047_decode (char **value)
1314    {
1315      char *charset = NULL;
1316      char *tmp;
1317      int rc;
1318    
1319      if (!*value || util_getenv (&charset, "charset", Mail_env_string, 0))
1320        return;
1321      if (strcasecmp (charset, "auto") == 0)
1322        {
1323          /* Try to deduce the charset from LC_ALL variable */
1324    
1325          tmp = getenv ("LC_ALL");
1326          if (tmp)
1327            {
1328              char *sp;
1329              char *lang;
1330              char *terr;
1331    
1332              lang = strtok_r (tmp, "_", &sp);
1333              terr = strtok_r (NULL, ".", &sp);
1334              charset = strtok_r (NULL, "@", &sp);
1335    
1336              if (!charset)
1337                charset = mu_charset_lookup (lang, terr);
1338            }
1339        }
1340    
1341      if (!charset)
1342        return;
1343      
1344      rc = rfc2047_decode (charset, *value, &tmp);
1345      if (rc)
1346        {
1347          if (util_getenv (NULL, "verbose", Mail_env_boolean, 0) == 0)
1348            mu_error (_("Can't decode line `%s': %s"), *value, mu_strerror (rc));
1349        }
1350      else
1351        {
1352          free (*value);
1353          *value = tmp;
1354        }
1355    }

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26