Esempio n. 1
0
void writeqs(const char *s)
{
size_t	i=strlen(s), j;

	while (i)
	{
		for (j=0; j<i; j++)
		{
			if ( s[j] == '"' || s[j] == '\\')
			{
				writemem(s, j);
				writemem("\\", 1);
				writemem(s+j, 1);
				++j;
				s += j;
				i -= j;
				j=0;
				break;
			}
#if 0
			if (s[j] == '&')
			{
				writemem(s, j);
				writemem("&-", 2);
				++j;
				s += j;
				i -= j;
				j=0;
				break;
			}

			if (s[j] < ' ' || s[j] >= 0x7F)
			{
			char	*q;

				writemem(s, j);
				++j;
				s += j;
				i -= j;
				for (j=0; j<i; j++)
					if (s[j] >= ' ' && s[j] < 0x7F)
						break;
				q=imap_utf7_encode(s, j);
				if (!q)	write_error_exit(0);
				writemem("&", 1);
				writes(q);
				writemem("-", 1);
				s += j;
				i -= j;
				j=0;
				break;
			}
#endif
		}
		writemem(s, j);
		s += j;
		i -= j;
	}
}
Esempio n. 2
0
void imap_munge_mbox_name (char *dest, size_t dlen, const char *src)
{
  char *buf;

  buf = str_dup (src);
  imap_utf7_encode (&buf);

  imap_quote_string (dest, dlen, buf);

  mem_free (&buf);
}