- Fix trac ticket #183: PT_UNICODE properties are now turned to UTF-8
authorJulien Kerihuel <j.kerihuel@openchange.org>
Tue, 2 Feb 2010 13:32:27 +0000 (13:32 +0000)
committerJulien Kerihuel <j.kerihuel@openchange.org>
Tue, 2 Feb 2010 13:32:27 +0000 (13:32 +0000)
  directly.

- Remove deprecated utf8_convert lexer and windows_to_utf8 routine

- Change openchange tools to use _UNICODE tag version instead

- octool_get_propval now prefer UNICODE properties over PT_STRING8
  ones (default behavior).

- Change mapidump_message API to take an optional mapi_object_t
  message parameter. If the message object is specified, we can have
  access to the subject, and recipients (to, cc, bcc) without having
  to query them within a GetProps call.

Makefile
libmapi/mapidump.c
libmapi/utf8_convert.l [deleted file]
libmapi/utils.c
torture/mapi_fetchmail.c
utils/mapitest/mapitest_common.c
utils/mapitest/modules/module_mapidump.c
utils/openchange-tools.c
utils/openchangeclient.c
utils/openchangepfadmin.c

index aee7606810ad67cb9a355cf466eeed2e497265d4..61431b7f592f45a7133cfecb652af500e775d450 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -178,7 +178,6 @@ libmapi-clean::
        rm -f libmapi/util/*.gcno libmapi/util/*.gcda
        rm -f libmapi/version.h
 ifneq ($(SNAPSHOT), no)
-       rm -f libmapi/utf8_convert.yy.c
        rm -f libmapi/mapicode.c libmapi/mapicode.h
        rm -f libmapi/mapitags.c libmapi/mapitags.h
        rm -f libmapi/mapi_nameid.h libmapi/mapi_nameid_private.h
@@ -301,8 +300,7 @@ libmapi.$(SHLIBEXT).$(PACKAGE_VERSION):             \
        gen_ndr/ndr_exchange_c.po                       \
        gen_ndr/ndr_property.po                         \
        libmapi/socket/interface.po                     \
-       libmapi/socket/netif.po                         \
-       libmapi/utf8_convert.yy.po
+       libmapi/socket/netif.po                         
        @echo "Linking $@"
        @$(CC) $(DSOOPT) $(CFLAGS) $(LDFLAGS) -Wl,-soname,libmapi.$(SHLIBEXT).$(LIBMAPI_SO_VERSION) -o $@ $^ $(LIBS)
 
@@ -313,14 +311,6 @@ libmapi.$(SHLIBEXT).$(LIBMAPI_SO_VERSION): libmapi.$(SHLIBEXT).$(PACKAGE_VERSION
 libmapi/version.h: VERSION
        @./script/mkversion.sh  VERSION libmapi/version.h $(PACKAGE_VERSION) $(top_builddir)/
 
-libmapi/utf8_convert.yy.c:     libmapi/utf8_convert.l
-       @echo "Generating $@"
-       @$(FLEX) -Plibmapi_utf8_convert_ -t $< > $@
-
-# Avoid warnings:
-libmapi/utf8_convert.yy.o: CFLAGS=
-libmapi/utf8_convert.yy.po: CFLAGS=
-
 libmapi/proto.h libmapi/proto_private.h:               \
        libmapi/nspi.c                                  \
        libmapi/emsmdb.c                                \
index 04b31b1fd39adb37bbd01b6e366c90effebc4fcb..43e3330ffa800d6637834aa14b61eb04ebd537d7 100644 (file)
@@ -307,10 +307,11 @@ _PUBLIC_ void mapidump_message_summary(mapi_object_t *obj_message)
 
    \param properties array of message properties
    \param id identification to display for the message (can be NULL)
+   \param obj_msg pointer to the message MAPI object (can be NULL)
 
    \sa mapidump_appointment, mapidump_contact, mapidump_task, mapidump_note
 */
-_PUBLIC_ void mapidump_message(struct mapi_SPropValue_array *properties, const char *id)
+_PUBLIC_ void mapidump_message(struct mapi_SPropValue_array *properties, const char *id, mapi_object_t *obj_msg)
 {
        const char                      *msgid;
        const char                      *from;
@@ -368,11 +369,15 @@ _PUBLIC_ void mapidump_message(struct mapi_SPropValue_array *properties, const c
 
        printf("+-------------------------------------+\n");
        printf("message id: %s %s\n", msgid ? msgid : "", id?id:"");
-       printf("subject: %s\n", subject ? subject : "");
-       printf("From: %s\n", from ? from : "");
-       printf("To:  %s\n", to ? to : "");
-       printf("Cc:  %s\n", cc ? cc : "");
-       printf("Bcc: %s\n", bcc ? bcc : "");
+       if (obj_msg) {
+               mapidump_message_summary(obj_msg);
+       } else {
+               printf("subject: %s\n", subject ? subject : "");
+               printf("From: %s\n", from ? from : "");
+               printf("To:  %s\n", to ? to : "");
+               printf("Cc:  %s\n", cc ? cc : "");
+               printf("Bcc: %s\n", bcc ? bcc : "");
+       }
        if (has_attach) {
                printf("Attachment: %s\n", *has_attach ? "True" : "False");
        }
diff --git a/libmapi/utf8_convert.l b/libmapi/utf8_convert.l
deleted file mode 100644 (file)
index 1f3e416..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
-   OpenChange MAPI implementation.
-
-   Copyright (C) Julien Kerihuel 2007.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-%option nounput
-%option noinput
-
-%{
-#include <stdlib.h>
-#include <string.h>
-
-int yylex(void);
-
-/*
- * Prototypes
- */
-
-int    yyget_lineno(void);
-FILE   *yyget_in(void);
-FILE   *yyget_out(void);
-int    yyget_leng(void);
-char   *yyget_text(void);
-void   yyset_lineno(int);
-void   yyset_in (FILE *);
-void   yyset_out (FILE *);
-int    yyget_debug(void);
-void   yyset_debug(int);
-int    yylex_destroy(void);
-
-int    yyreplace_utf8(char *);
-int    yyparse_utf8(char *, char *);
-
-char *newbuf;
-int  newbuf_idx;
-
-#define        U00A1   "\xc2\xa1"      /* ¡ */
-#define        U00A2   "\xc2\xa2"      /* ¢ */
-#define        U00A3   "\xc2\xa3"      /* £ */
-#define        U00A4   "\xc2\xa4"      /* ¤ */
-#define        U00A5   "\xc2\xa5"      /* ¥ */
-#define        U00A6   "\xc2\xa6"      /* ¦ */
-#define        U00A7   "\xc2\xa7"      /* § */
-#define        U00A8   "\xc2\xa8"      /* ¨ */
-#define        U00A9   "\xc2\xa9"      /* © */
-#define        U00AA   "\xc2\xaa"      /* ª */
-#define        U00AB   "\xc2\xab"      /* « */
-#define        U00AC   "\xc2\xac"      /* ¬ */
-#define U00AD  "\xc2\xad"      /* ­ */
-#define U00AE  "\xc2\xae"      /* ® */
-#define U00AF  "\xc2\xaf"      /* ¯ */
-#define U00B0  "\xc2\xb0"      /* ° */
-#define U00B1  "\xc2\xb1"      /* ± */
-#define U00B2  "\xc2\xb2"      /* ² */
-#define U00B3  "\xc2\xb3"      /* ³ */
-#define U00B4  "\xc2\xb4"      /* ´ */
-#define U00B5  "\xc2\xb5"      /* µ */
-#define U00B6  "\xc2\xb6"      /* ¶ */
-#define U00B7  "\xc2\xb7"      /* · */
-#define U00B8  "\xc2\xb8"      /* ¸ */
-#define U00B9  "\xc2\xb9"      /* ¹ */
-#define U00BA  "\xc2\xba"      /* º */
-#define U00BB  "\xc2\xbb"      /* » */
-#define U00BC  "\xc2\xbc"      /* ¼ */
-#define U00BD  "\xc2\xbd"      /* ½ */
-#define U00BE  "\xc2\xbe"      /* ¾ */
-#define U00BF  "\xc2\xbf"      /* ¿ */
-#define U00C0  "\xc3\x80"      /* À */
-#define U00C1  "\xc3\x81"      /* Á */
-#define U00C2  "\xc3\x82"      /* Â */
-#define U00C3  "\xc3\x83"      /* Ã */
-#define U00C4  "\xc3\x84"      /* Ä */
-#define U00C5  "\xc3\x85"      /* Å */
-#define U00C6  "\xc3\x86"      /* Æ */
-#define U00C7  "\xc3\x87"      /* Ç */
-#define U00C8  "\xc3\x88"      /* È */
-#define        U00C9   "\xc3\x89"      /* É */
-#define        U00CA   "\xc3\x8a"      /* Ê */
-#define        U00CB   "\xc3\x8b"      /* Ë */
-#define        U00CC   "\xc3\x8c"      /* Ì */
-#define        U00CD   "\xc3\x8d"      /* Í */
-#define        U00CE   "\xc3\x8e"      /* Î */
-#define        U00CF   "\xc3\x8f"      /* Ï */
-#define        U00D0   "\xc3\x90"      /* Ð */
-#define        U00D1   "\xc3\x91"      /* Ñ */
-#define        U00D2   "\xc3\x92"      /* Ò */
-#define        U00D3   "\xc3\x93"      /* Ó */
-#define        U00D4   "\xc3\x94"      /* Ô */
-#define        U00D5   "\xc3\x95"      /* Õ */
-#define        U00D6   "\xc3\x96"      /* Ö */
-#define        U00D7   "\xc3\x97"      /* × */
-#define        U00D8   "\xc3\x98"      /* Ø */
-#define        U00D9   "\xc3\x99"      /* Ù */
-#define        U00DA   "\xc3\x9a"      /* Ú */
-#define        U00DB   "\xc3\x9b"      /* Û */
-#define        U00DC   "\xc3\x9c"      /* Ü */
-#define        U00DD   "\xc3\x9d"      /* Ý */
-#define        U00DE   "\xc3\x9e"      /* Þ */
-#define        U00DF   "\xc3\x9f"      /* ß */
-#define        U00E0   "\xc3\xa0"      /* à */
-#define        U00E1   "\xc3\xa1"      /* á */
-#define        U00E2   "\xc3\xa2"      /* â */
-#define        U00E3   "\xc3\xa3"      /* ã */
-#define        U00E4   "\xc3\xa4"      /* ä */
-#define        U00E5   "\xc3\xa5"      /* å */
-#define        U00E6   "\xc3\xa6"      /* æ */
-#define        U00E7   "\xc3\xa7"      /* ç */
-#define        U00E8   "\xc3\xa8"      /* è */
-#define        U00E9   "\xc3\xa9"      /* é */
-#define        U00EA   "\xc3\xaa"      /* ê */
-#define        U00EB   "\xc3\xab"      /* ë */
-#define        U00EC   "\xc3\xac"      /* ì */
-#define        U00ED   "\xc3\xad"      /* í */
-#define        U00EE   "\xc3\xae"      /* î */
-#define        U00EF   "\xc3\xaf"      /* ï */
-#define        U00F0   "\xc3\xb0"      /* ð */
-#define        U00F1   "\xc3\xb1"      /* ñ */
-#define        U00F2   "\xc3\xb2"      /* ò */
-#define        U00F3   "\xc3\xb3"      /* ó */
-#define        U00F4   "\xc3\xb4"      /* ô */
-#define        U00F5   "\xc3\xb5"      /* õ */
-#define        U00F6   "\xc3\xb6"      /* ö */
-#define        U00F7   "\xc3\xb7"      /* ÷ */
-#define        U00F8   "\xc3\xb8"      /* ø */
-#define        U00F9   "\xc3\xb9"      /* ù */
-#define        U00FA   "\xc3\xba"      /* ú */
-#define        U00FB   "\xc3\xbb"      /* û */
-#define        U00FC   "\xc3\xbc"      /* ü */
-#define        U00FD   "\xc3\xbd"      /* ý */
-#define        U00FE   "\xc3\xbe"      /* þ */
-#define        U00FF   "\xc3\xbf"      /* ÿ */
-
-%}
-
-chars [0-9A-za-z\_\'\.\"/\+\-=\{\}:]
-numbers ([0-9])+
-delim [" "\n\t\s]
-whitespace {delim}+
-words {chars}+
-
-WIN_U00A1      "\xc3\xad"
-WIN_U00A2      "\xc3\xb3"
-WIN_U00A3      "\xc3\xba"
-WIN_U00A4      "\xc3\xb1"
-WIN_U00A5      "\xc3\x91"
-WIN_U00A6      "\xc2\xaa"
-WIN_U00A7      "\xc2\xba"
-WIN_U00A8      "\xc2\xbf"
-WIN_U00A9      "\xc2\xae"
-WIN_U00AA      "\xc2\xac"
-WIN_U00AB      "\xc2\xbd"
-WIN_U00AC      "\xc2\xbc"
-WIN_U00AD      "\xc2\xa1"
-WIN_U00AE      "\xc2\xab"
-WIN_U00AF      "\xc2\xbb"
-WIN_U00B0      "\xe2\x96\x91"
-WIN_U00B1      "\xe2\x96\x92"
-WIN_U00B2      "\xe2\x96\x93"
-WIN_U00B3      "\xe2\x94\x82"
-WIN_U00B4      "\xe2\x94\xa4"
-WIN_U00B5      "\xc3\x81"
-WIN_U00B6      "\xc3\x82"
-WIN_U00B7      "\xc3\x80"
-WIN_U00B8      "\xc2\xa9"
-WIN_U00B9      "\xe2\x95\xa3"
-WIN_U00BA      "\xe2\x95\x91"
-WIN_U00BB      "\xe2\x95\x97"
-WIN_U00BC      "\xe2\x95\x9d"
-WIN_U00BD      "\xc2\xa2"
-WIN_U00BE      "\xc2\xa5"
-WIN_U00BF      "\xe2\x94\x90"
-WIN_U00C0      "\xe2\x94\x94"
-WIN_U00C1      "\xe2\x94\xb4"
-WIN_U00C2      "\xe2\x94\xac"
-WIN_U00C3      "\xe2\x94\x9c"
-WIN_U00C4      "\xe2\x94\x80"
-WIN_U00C5      "\xe2\x94\xbc"
-WIN_U00C6      "\xc3\xa3"
-WIN_U00C7      "\xc3\x83"
-WIN_U00C8      "\xe2\x95\x9a"
-WIN_U00C9      "\xe2\x95\x94"
-WIN_U00CA      "\xe2\x95\xa9"
-WIN_U00CB      "\xe2\x95\xa6"
-WIN_U00CC      "\xe2\x95\xa0"
-WIN_U00CD      "\xe2\x95\x90"
-WIN_U00CE      "\xe2\x95\xac"
-WIN_U00CF      "\xc2\xa4"
-WIN_U00D0      "\xc3\xb0"
-WIN_U00D1      "\xc3\x90"
-WIN_U00D2      "\xc3\x8a"
-WIN_U00D3      "\xc3\x8b"
-WIN_U00D4      "\xc3\x88"
-WIN_U00D5      "\xc4\xb1"
-WIN_U00D6      "\xc3\x8d"
-WIN_U00D7      "\xc3\x8e"
-WIN_U00D8      "\xc3\x8f"
-WIN_U00D9      "\xe2\x94\x98"
-WIN_U00DA      "\xe2\x94\x8c"
-WIN_U00DB      "\xe2\x96\x88"
-WIN_U00DC      "\xe2\x96\x84"
-WIN_U00DD      "\xc2\xa6"
-WIN_U00DE      "\xc3\x8c"
-WIN_U00DF      "\xe2\x96\x80"
-WIN_U00E0      "\xc3\x93"
-WIN_U00E1      "\xc3\x9f"
-WIN_U00E2      "\xc3\x94"
-WIN_U00E3      "\xc3\x92"
-WIN_U00E4      "\xc3\xb5"
-WIN_U00E5      "\xc3\x95"
-WIN_U00E6      "\xc2\xb5"
-WIN_U00E7      "\xc3\xbe"
-WIN_U00E8      "\xc3\x9e"
-WIN_U00E9      "\xc3\x9a"
-WIN_U00EA      "\xc3\x9b"
-WIN_U00EB      "\xc3\x99"
-WIN_U00EC      "\xc3\xbd"
-WIN_U00ED      "\xc3\x9d"
-WIN_U00EE      "\xc2\xaf"
-WIN_U00EF      "\xc2\xb4"
-WIN_U00F0      "\xc2\xad"
-WIN_U00F1      "\xc2\xb1"
-WIN_U00F2      "\xe2\x80\x97"
-WIN_U00F3      "\xc2\xbe"
-WIN_U00F4      "\xc2\xb6"
-WIN_U00F5      "\xc2\xa7"
-WIN_U00F6      "\xc3\xb7"
-WIN_U00F7      "\xc2\xb8"
-WIN_U00F8      "\xc2\xb0"
-WIN_U00F9      "\xc2\xa8"
-WIN_U00FA      "\xc2\xb7"
-WIN_U00FB      "\xc2\xb9"
-WIN_U00FC      "\xc2\xb3"
-WIN_U00FD      "\xc2\xb2"
-WIN_U00FE      "\xe2\x96\xa0"
-WIN_U00FF      "\xc2\xa0"
-
-
-%%
-{words} { yyreplace_utf8(yytext); }
-{delim} { yyreplace_utf8(yytext); }
-{whitespace} { yyreplace_utf8(yytext); }
-{WIN_U00A1} { yyreplace_utf8(U00A1);}
-{WIN_U00A2} { yyreplace_utf8(U00A2);}
-{WIN_U00A3} { yyreplace_utf8(U00A3);}
-{WIN_U00A4} { yyreplace_utf8(U00A4);}
-{WIN_U00A5} { yyreplace_utf8(U00A5);}
-{WIN_U00A6} { yyreplace_utf8(U00A6);}
-{WIN_U00A7} { yyreplace_utf8(U00A7);}
-{WIN_U00A8} { yyreplace_utf8(U00A8);}
-{WIN_U00A9} { yyreplace_utf8(U00A9);}
-{WIN_U00AA} { yyreplace_utf8(U00AA);}
-{WIN_U00AB} { yyreplace_utf8(U00AB);}
-{WIN_U00AC} { yyreplace_utf8(U00AC);}
-{WIN_U00AD} { yyreplace_utf8(U00AD);}
-{WIN_U00AE} { yyreplace_utf8(U00AE);}
-{WIN_U00AF} { yyreplace_utf8(U00AF);}
-{WIN_U00B0} { yyreplace_utf8(U00B0);}
-{WIN_U00B1} { yyreplace_utf8(U00B1);}
-{WIN_U00B2} { yyreplace_utf8(U00B2);}
-{WIN_U00B3} { yyreplace_utf8(U00B3);}
-{WIN_U00B4} { yyreplace_utf8(U00B4);}
-{WIN_U00B5} { yyreplace_utf8(U00B5);}
-{WIN_U00B6} { yyreplace_utf8(U00B6);}
-{WIN_U00B7} { yyreplace_utf8(U00B7);}
-{WIN_U00B8} { yyreplace_utf8(U00B8);}
-{WIN_U00B9} { yyreplace_utf8(U00B9);}
-{WIN_U00BA} { yyreplace_utf8(U00BA);}
-{WIN_U00BB} { yyreplace_utf8(U00BB);}
-{WIN_U00BC} { yyreplace_utf8(U00BC);}
-{WIN_U00BD} { yyreplace_utf8(U00BD);}
-{WIN_U00BE} { yyreplace_utf8(U00BE);}
-{WIN_U00BF} { yyreplace_utf8(U00BF);}
-{WIN_U00C0} { yyreplace_utf8(U00C0);}
-{WIN_U00C1} { yyreplace_utf8(U00C1);}
-{WIN_U00C2} { yyreplace_utf8(U00C2);}
-{WIN_U00C3} { yyreplace_utf8(U00C3);}
-{WIN_U00C4} { yyreplace_utf8(U00C4);}
-{WIN_U00C5} { yyreplace_utf8(U00C5);}
-{WIN_U00C6} { yyreplace_utf8(U00C6);}
-{WIN_U00C7} { yyreplace_utf8(U00C7);}
-{WIN_U00C8} { yyreplace_utf8(U00C8);}
-{WIN_U00C9} { yyreplace_utf8(U00C9);}
-{WIN_U00CA} { yyreplace_utf8(U00CA);}
-{WIN_U00CB} { yyreplace_utf8(U00CB);}
-{WIN_U00CC} { yyreplace_utf8(U00CC);}
-{WIN_U00CD} { yyreplace_utf8(U00CD);}
-{WIN_U00CE} { yyreplace_utf8(U00CE);}
-{WIN_U00CF} { yyreplace_utf8(U00CF);}
-{WIN_U00D0} { yyreplace_utf8(U00D0);}
-{WIN_U00D1} { yyreplace_utf8(U00D1);}
-{WIN_U00D2} { yyreplace_utf8(U00D2);}
-{WIN_U00D3} { yyreplace_utf8(U00D3);}
-{WIN_U00D4} { yyreplace_utf8(U00D4);}
-{WIN_U00D5} { yyreplace_utf8(U00D5);}
-{WIN_U00D6} { yyreplace_utf8(U00D6);}
-{WIN_U00D7} { yyreplace_utf8(U00D7);}
-{WIN_U00D8} { yyreplace_utf8(U00D8);}
-{WIN_U00D9} { yyreplace_utf8(U00D9);}
-{WIN_U00DA} { yyreplace_utf8(U00DA);}
-{WIN_U00DB} { yyreplace_utf8(U00DB);}
-{WIN_U00DC} { yyreplace_utf8(U00DC);}
-{WIN_U00DD} { yyreplace_utf8(U00DD);}
-{WIN_U00DE} { yyreplace_utf8(U00DE);}
-{WIN_U00DF} { yyreplace_utf8(U00DF);}
-{WIN_U00E0} { yyreplace_utf8(U00E0);}
-{WIN_U00E1} { yyreplace_utf8(U00E1);}
-{WIN_U00E2} { yyreplace_utf8(U00E2);}
-{WIN_U00E3} { yyreplace_utf8(U00E3);}
-{WIN_U00E4} { yyreplace_utf8(U00E4);}
-{WIN_U00E5} { yyreplace_utf8(U00E5);}
-{WIN_U00E6} { yyreplace_utf8(U00E6);}
-{WIN_U00E7} { yyreplace_utf8(U00E7);}
-{WIN_U00E8} { yyreplace_utf8(U00E8);}
-{WIN_U00E9} { yyreplace_utf8(U00E9);}
-{WIN_U00EA} { yyreplace_utf8(U00EA);}
-{WIN_U00EB} { yyreplace_utf8(U00EB);}
-{WIN_U00EC} { yyreplace_utf8(U00EC);}
-{WIN_U00ED} { yyreplace_utf8(U00ED);}
-{WIN_U00EE} { yyreplace_utf8(U00EE);}
-{WIN_U00EF} { yyreplace_utf8(U00EF);}
-{WIN_U00F0} { yyreplace_utf8(U00F0);}
-{WIN_U00F1} { yyreplace_utf8(U00F1);}
-{WIN_U00F2} { yyreplace_utf8(U00F2);}
-{WIN_U00F3} { yyreplace_utf8(U00F3);}
-{WIN_U00F4} { yyreplace_utf8(U00F4);}
-{WIN_U00F5} { yyreplace_utf8(U00F5);}
-{WIN_U00F6} { yyreplace_utf8(U00F6);}
-{WIN_U00F7} { yyreplace_utf8(U00F7);}
-{WIN_U00F8} { yyreplace_utf8(U00F8);}
-{WIN_U00F9} { yyreplace_utf8(U00F9);}
-{WIN_U00FA} { yyreplace_utf8(U00FA);}
-{WIN_U00FB} { yyreplace_utf8(U00FB);}
-{WIN_U00FC} { yyreplace_utf8(U00FC);}
-{WIN_U00FD} { yyreplace_utf8(U00FD);}
-{WIN_U00FE} { yyreplace_utf8(U00FE);}
-{WIN_U00FF} { yyreplace_utf8(U00FF);}
-
-%%
-
-#ifndef yywrap
-int 
-yywrap(void) 
-{
-       return 1;
-}
-#endif
-
-int
-yyreplace_utf8(char *str)
-{
-       memcpy(&newbuf[newbuf_idx], str, strlen(str));
-       newbuf_idx += strlen(str);
-       return 0;
-}
-
-int
-yyparse_utf8(char *mybuf, char *str)
-{
-       newbuf = mybuf;
-       newbuf_idx = 0;
-       yy_scan_string(str);
-       yylex();
-       newbuf[newbuf_idx] = 0;
-       libmapi_utf8_convert_lex_destroy();
-       return 0;
-}
index 93b72923f3af1289f9161980f8c3cda9c67aefa9..fa0c724fee4f66a61acd0c43762dfbf470628247 100644 (file)
@@ -100,30 +100,6 @@ _PUBLIC_ struct Binary_r *generate_recipient_entryid(TALLOC_CTX *mem_ctx, const
        return entryid;
 }
 
-/**
- * convert utf8 windows string into classic utf8
- * NOTE: windows utf8 encoding is equal or larger to classic utf8
- *       we should anyway find a better way to allocate the output buf
- */
-
-int yyparse_utf8(char *, const char *);
-
-_PUBLIC_ char *windows_to_utf8(TALLOC_CTX *mem_ctx, const char *input)
-{
-       char    *tmp = NULL;
-       char    *output;
-
-       if (!input) return NULL;
-
-       tmp = malloc(strlen(input) + 1);
-       yyparse_utf8(tmp, input);
-       output = talloc_strdup(mem_ctx, tmp);
-       free(tmp);
-       
-       return output;
-}
-
-
 /**
    \details Create a FID from an EntryID
 
index f7d5bb0dfa2edf12997d11bf20fe15817e68da9f..e44f2be28fd0eb3d44002d670c3aa0bf741459b4 100644 (file)
@@ -117,7 +117,7 @@ bool torture_rpc_mapi_fetchmail(struct torture_context *torture)
 
                        if (GetLastError() != MAPI_E_NOT_FOUND) {
                          retval = GetPropsAll(&obj_message, &properties_array);
-                         mapidump_message(&properties_array, NULL);
+                         mapidump_message(&properties_array, NULL, &obj_message);
                          mapi_object_release(&obj_message);
                        }
                }
index f4160bd08075d00e6389d77ba46e9359f7ef7b9c..8cf8ed80da0155a2ab7b78b269d226ec88f1920e 100644 (file)
@@ -158,8 +158,7 @@ _PUBLIC_ bool mapitest_common_find_folder(struct mapitest *mt,
        struct SPropTagArray    *SPropTagArray;
        struct SRowSet          rowset;
        mapi_object_t           obj_htable;
-       const char              *tmp;
-       char                    *newname;
+       const char              *newname;
        const uint64_t          *fid;
        uint32_t                count;
        uint32_t                index;
@@ -184,16 +183,13 @@ _PUBLIC_ bool mapitest_common_find_folder(struct mapitest *mt,
        while (((retval = QueryRows(&obj_htable, count, TBL_ADVANCE, &rowset)) != MAPI_E_NOT_FOUND) && rowset.cRows) {
                for (index = 0; index < rowset.cRows; index++) {
                        fid = (const uint64_t *)find_SPropValue_data(&rowset.aRow[index], PR_FID);
-                       tmp = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME);
+                       newname = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME);
 
-                       newname = windows_to_utf8(mt->mem_ctx, tmp);
                        if (newname && fid && !strcmp(newname, name)) {
                                retval = OpenFolder(obj_parent, *fid, obj_child);
                                mapi_object_release(&obj_htable);
-                               MAPIFreeBuffer(newname);
                                return true;
                        }
-                       MAPIFreeBuffer(newname);
                }
        }
 
index 75c36108e971861c2a4665261c4ea8307d542c95..8a7de1d12800dde99043d3daf168267161ae8a0b 100644 (file)
@@ -563,37 +563,37 @@ _PUBLIC_ bool mapitest_mapidump_message(struct mapitest *mt)
        props.lpProps[8].ulPropTag = PR_HASATTACH;
        props.lpProps[8].value.b = false;
 
-       mapidump_message(&props, "[dummy ID]");
+       mapidump_message(&props, "[dummy ID]", NULL);
 
        props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
        props.lpProps[7].value.l = CP_USASCII;
 
-       mapidump_message(&props, "[dummy ID]");
+       mapidump_message(&props, "[dummy ID]", NULL);
 
        props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
        props.lpProps[7].value.l = CP_UNICODE;
 
-       mapidump_message(&props, "[dummy ID]");
+       mapidump_message(&props, "[dummy ID]", NULL);
 
        props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
        props.lpProps[7].value.l = CP_JAUTODETECT;
 
-       mapidump_message(&props, "[dummy ID]");
+       mapidump_message(&props, "[dummy ID]", NULL);
 
        props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
        props.lpProps[7].value.l = CP_KAUTODETECT;
 
-       mapidump_message(&props, "[dummy ID]");
+       mapidump_message(&props, "[dummy ID]", NULL);
 
        props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
        props.lpProps[7].value.l = CP_ISO2022JPESC;
 
-       mapidump_message(&props, "[dummy ID]");
+       mapidump_message(&props, "[dummy ID]", NULL);
 
        props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
        props.lpProps[7].value.l = CP_ISO2022JPSIO;
 
-       mapidump_message(&props, "[dummy ID]");
+       mapidump_message(&props, "[dummy ID]", NULL);
 
        return true;
 }
index e6f72388d2901a67ec82df43b1f58bc9cda99f47..548f2821f9c3b71fd5471694e984c4e61bf6dc60 100644 (file)
@@ -45,7 +45,7 @@ struct poptOption popt_openchange_version[] = {
 /*
  * Retrieve the property value for a given SRow and property tag.  
  *
- * If the property type is a string: fetch PT_STRING8 then PT_UNICODE
+ * If the property type is a string: fetch PT_UNICODE then PT_STRING8
  * in case the desired property is not available in first choice.
  *
  * Fetch property normally for any others properties
@@ -56,11 +56,11 @@ _PUBLIC_ void *octool_get_propval(struct SRow *aRow, uint32_t proptag)
 
        if (((proptag & 0xFFFF) == PT_STRING8) ||
            ((proptag & 0xFFFF) == PT_UNICODE)) {
-               proptag = (proptag & 0xFFFF0000) | PT_STRING8;
+               proptag = (proptag & 0xFFFF0000) | PT_UNICODE;
                str = (const char *) find_SPropValue_data(aRow, proptag);
                if (str) return (void *)str;
 
-               proptag = (proptag & 0xFFFF0000) | PT_UNICODE;
+               proptag = (proptag & 0xFFFF0000) | PT_STRING8;
                str = (const char *) find_SPropValue_data(aRow, proptag);
                return (void *)str;
        } 
@@ -125,13 +125,13 @@ _PUBLIC_ enum MAPISTATUS octool_get_body(TALLOC_CTX *mem_ctx,
 
        switch (format) {
        case olEditorText:
-               data = octool_get_propval(aRow, PR_BODY);
+               data = octool_get_propval(aRow, PR_BODY_UNICODE);
                if (data) {
                        body->data = talloc_memdup(mem_ctx, data, strlen(data));
                        body->length = strlen(data);
                } else {
                        mapi_object_init(&obj_stream);
-                       retval = OpenStream(obj_message, PR_BODY, 0, &obj_stream);
+                       retval = OpenStream(obj_message, PR_BODY_UNICODE, 0, &obj_stream);
                        MAPI_RETVAL_IF(retval, GetLastError(), NULL);
                        
                        retval = octool_get_stream(mem_ctx, &obj_stream, body);
@@ -239,9 +239,9 @@ _PUBLIC_ enum MAPISTATUS octool_message(TALLOC_CTX *mem_ctx,
        }
        
        from = (const char *) octool_get_propval(&aRow, PR_SENT_REPRESENTING_NAME);
-       to = (const char *) octool_get_propval(&aRow, PR_DISPLAY_TO);
-       cc = (const char *) octool_get_propval(&aRow, PR_DISPLAY_CC);
-       bcc = (const char *) octool_get_propval(&aRow, PR_DISPLAY_BCC);
+       to = (const char *) octool_get_propval(&aRow, PR_DISPLAY_TO_UNICODE);
+       cc = (const char *) octool_get_propval(&aRow, PR_DISPLAY_CC_UNICODE);
+       bcc = (const char *) octool_get_propval(&aRow, PR_DISPLAY_BCC_UNICODE);
 
        has_attach = (const uint8_t *) octool_get_propval(&aRow, PR_HASATTACH);
        cp = (const uint32_t *) octool_get_propval(&aRow, PR_MESSAGE_CODEPAGE);
index 90ed3ccfcac0e9747d64dcf86bd3df3108016594..bfae9ed303a9b599c13c5d1811ad6a8898ac9279 100644 (file)
@@ -94,14 +94,6 @@ static void init_oclient(struct oclient *oclient)
        oclient->ocpf_dump = NULL;
 }
 
-static char *utf8tolinux(TALLOC_CTX *mem_ctx, const char *wstring)
-{
-       char            *newstr;
-
-       newstr = windows_to_utf8(mem_ctx, wstring);
-       return newstr;
-}
-
 static enum MAPISTATUS openchangeclient_getdir(TALLOC_CTX *mem_ctx,
                                               mapi_object_t *obj_container,
                                               mapi_object_t *obj_child,
@@ -112,7 +104,6 @@ static enum MAPISTATUS openchangeclient_getdir(TALLOC_CTX *mem_ctx,
        struct SRowSet          SRowSet;
        mapi_object_t           obj_htable;
        mapi_object_t           obj_folder;
-       char                    *newname;
        char                    **folder  = NULL;
        const char              *name;
        const uint64_t          *fid;
@@ -141,17 +132,15 @@ static enum MAPISTATUS openchangeclient_getdir(TALLOC_CTX *mem_ctx,
                while (((retval = QueryRows(&obj_htable, 0x32, TBL_ADVANCE, &SRowSet)) != MAPI_E_NOT_FOUND) && SRowSet.cRows) {
                        for (index = 0; (index < SRowSet.cRows) && (found == false); index++) {
                                fid = (const uint64_t *)find_SPropValue_data(&SRowSet.aRow[index], PR_FID);
-                               name = (const char *)find_SPropValue_data(&SRowSet.aRow[index], PR_DISPLAY_NAME);
+                               name = (const char *)find_SPropValue_data(&SRowSet.aRow[index], PR_DISPLAY_NAME_UNICODE);
 
-                               newname = utf8tolinux(mem_ctx, name);
-                               if (newname && fid && !strcmp(newname, folder[i])) {
+                               if (name && fid && !strcmp(name, folder[i])) {
                                        retval = OpenFolder(&obj_folder, *fid, obj_child);
                                        MAPI_RETVAL_IF(retval, retval, folder);
 
                                        found = true;
                                        mapi_object_copy(&obj_folder, obj_child);
                                }
-                               MAPIFreeBuffer(newname);
                        }
                }
 
@@ -1561,7 +1550,6 @@ static bool get_child_folders(TALLOC_CTX *mem_ctx, mapi_object_t *parent, mapi_i
        struct SPropTagArray    *SPropTagArray;
        struct SRowSet          rowset;
        const char              *name;
-       char                    *newname;
        const char              *comment;
        const uint32_t          *total;
        const uint32_t          *unread;
@@ -1579,9 +1567,9 @@ static bool get_child_folders(TALLOC_CTX *mem_ctx, mapi_object_t *parent, mapi_i
        if (retval != MAPI_E_SUCCESS) return false;
 
        SPropTagArray = set_SPropTagArray(mem_ctx, 0x6,
-                                         PR_DISPLAY_NAME,
+                                         PR_DISPLAY_NAME_UNICODE,
                                          PR_FID,
-                                         PR_COMMENT,
+                                         PR_COMMENT_UNICODE,
                                          PR_CONTENT_UNREAD,
                                          PR_CONTENT_COUNT,
                                          PR_FOLDER_CHILD_COUNT);
@@ -1592,8 +1580,8 @@ static bool get_child_folders(TALLOC_CTX *mem_ctx, mapi_object_t *parent, mapi_i
        while (((retval = QueryRows(&obj_htable, 0x32, TBL_ADVANCE, &rowset)) != MAPI_E_NOT_FOUND) && rowset.cRows) {
                for (index = 0; index < rowset.cRows; index++) {
                        fid = (const uint64_t *)find_SPropValue_data(&rowset.aRow[index], PR_FID);
-                       name = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME);
-                       comment = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_COMMENT);
+                       name = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME_UNICODE);
+                       comment = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_COMMENT_UNICODE);
                        total = (const uint32_t *)find_SPropValue_data(&rowset.aRow[index], PR_CONTENT_COUNT);
                        unread = (const uint32_t *)find_SPropValue_data(&rowset.aRow[index], PR_CONTENT_UNREAD);
                        child = (const uint32_t *)find_SPropValue_data(&rowset.aRow[index], PR_FOLDER_CHILD_COUNT);
@@ -1601,11 +1589,9 @@ static bool get_child_folders(TALLOC_CTX *mem_ctx, mapi_object_t *parent, mapi_i
                        for (i = 0; i < count; i++) {
                                printf("|   ");
                        }
-                       newname = utf8tolinux(mem_ctx, name);
                        printf("|---+ %-15s : %-20s (Total: %u / Unread: %u - Container class: %s) [FID: 0x%016"PRIx64"]\n", 
-                              newname, comment?comment:"", total?*total:0, unread?*unread:0,
+                              name, comment?comment:"", total?*total:0, unread?*unread:0,
                               get_container_class(mem_ctx, parent, *fid), *fid);
-                       MAPIFreeBuffer(newname);
                        if (child && *child) {
                                ret = get_child_folders(mem_ctx, &obj_folder, *fid, count + 1);
                                if (ret == false) return ret;
@@ -1625,7 +1611,6 @@ static bool get_child_folders_pf(TALLOC_CTX *mem_ctx, mapi_object_t *parent, map
        struct SPropTagArray    *SPropTagArray;
        struct SRowSet          rowset;
        const char              *name;
-       char                    *newname;
        const uint32_t          *child;
        uint32_t                index;
        const uint64_t          *fid;
@@ -1640,7 +1625,7 @@ static bool get_child_folders_pf(TALLOC_CTX *mem_ctx, mapi_object_t *parent, map
        if (retval != MAPI_E_SUCCESS) return false;
 
        SPropTagArray = set_SPropTagArray(mem_ctx, 0x3,
-                                         PR_DISPLAY_NAME,
+                                         PR_DISPLAY_NAME_UNICODE,
                                          PR_FID,
                                          PR_FOLDER_CHILD_COUNT);
        retval = SetColumns(&obj_htable, SPropTagArray);
@@ -1650,15 +1635,13 @@ static bool get_child_folders_pf(TALLOC_CTX *mem_ctx, mapi_object_t *parent, map
        while (((retval = QueryRows(&obj_htable, 0x32, TBL_ADVANCE, &rowset)) != MAPI_E_NOT_FOUND) && rowset.cRows) {
                for (index = 0; index < rowset.cRows; index++) {
                        fid = (const uint64_t *)find_SPropValue_data(&rowset.aRow[index], PR_FID);
-                       name = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME);
+                       name = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME_UNICODE);
                        child = (const uint32_t *)find_SPropValue_data(&rowset.aRow[index], PR_FOLDER_CHILD_COUNT);
 
                        for (i = 0; i < count; i++) {
                                printf("|   ");
                        }
-                       newname = utf8tolinux(mem_ctx, name);
-                       printf("|---+ %-15s [FID: 0x%016"PRIx64"]\n", newname, *fid);
-                       MAPIFreeBuffer(newname);
+                       printf("|---+ %-15s [FID: 0x%016"PRIx64"]\n", name, *fid);
                        if (*child) {
                                ret = get_child_folders_pf(mem_ctx, &obj_folder, *fid, count + 1);
                                if (ret == false) return ret;
@@ -1691,16 +1674,15 @@ static bool openchangeclient_mailbox(TALLOC_CTX *mem_ctx,
        struct SPropValue               *lpProps;
        uint32_t                        cValues;
        const char                      *mailbox_name;
-       char                            *utf8_mailbox_name;
 
        /* Retrieve the mailbox folder name */
-       SPropTagArray = set_SPropTagArray(mem_ctx, 0x1, PR_DISPLAY_NAME);
+       SPropTagArray = set_SPropTagArray(mem_ctx, 0x1, PR_DISPLAY_NAME_UNICODE);
        retval = GetProps(obj_store, SPropTagArray, &lpProps, &cValues);
        MAPIFreeBuffer(SPropTagArray);
        if (retval != MAPI_E_SUCCESS) return false;
 
-       if (lpProps[0].value.lpszA) {
-               mailbox_name = lpProps[0].value.lpszA;
+       if (lpProps[0].value.lpszW) {
+               mailbox_name = lpProps[0].value.lpszW;
        } else {
                return false;
        }
@@ -1709,9 +1691,7 @@ static bool openchangeclient_mailbox(TALLOC_CTX *mem_ctx,
        retval = GetDefaultFolder(obj_store, &id_mailbox, olFolderTopInformationStore);
        if (retval != MAPI_E_SUCCESS) return false;
 
-       utf8_mailbox_name = utf8tolinux(mem_ctx, mailbox_name);
-       printf("+ %s\n", utf8_mailbox_name);
-       MAPIFreeBuffer(utf8_mailbox_name);
+       printf("+ %s\n", mailbox_name);
        return get_child_folders(mem_ctx, obj_store, id_mailbox, 0);
 }
 
@@ -1809,7 +1789,7 @@ static bool openchangeclient_fetchitems(TALLOC_CTX *mem_ctx, mapi_object_t *obj_
                                                                            &properties_array);
                                                switch (olFolder) {
                                                case olFolderInbox:
-                                                       mapidump_message(&properties_array, id);
+                                                 mapidump_message(&properties_array, id, NULL);
                                                        break;
                                                case olFolderCalendar:
                                                        mapidump_appointment(&properties_array, id);
@@ -2136,7 +2116,7 @@ static enum MAPISTATUS openchangeclient_findmail(mapi_object_t *obj_store,
                                                id = talloc_asprintf(mem_ctx, ": %"PRIX64"/%"PRIX64,
                                                                     SRowSet.aRow[i].lpProps[0].value.d,
                                                                     SRowSet.aRow[i].lpProps[1].value.d);
-                                               mapidump_message(&properties_array, id);
+                                               mapidump_message(&properties_array, id, NULL);
                                                mapi_object_release(&obj_message);
                                                talloc_free(id);
 
index 2049df3b2fd5084aa01a71cf29a4132076f1672f..029296240a1bafff7284a0946d1f21fdd88e6337 100644 (file)
@@ -76,14 +76,6 @@ static void list_IPF_class(void)
        }
 }
 
-static char *utf8tolinux(TALLOC_CTX *mem_ctx, const char *wstring)
-{
-       char            *newstr;
-
-       newstr = windows_to_utf8(mem_ctx, wstring);
-       return newstr;
-}
-
 static bool get_child_folders_pf(TALLOC_CTX *mem_ctx, mapi_object_t *parent, mapi_id_t folder_id, int count)
 {
        enum MAPISTATUS         retval;
@@ -93,7 +85,6 @@ static bool get_child_folders_pf(TALLOC_CTX *mem_ctx, mapi_object_t *parent, map
        struct SPropTagArray    *SPropTagArray;
        struct SRowSet          rowset;
        const char              *name;
-       char                    *newname;
        const uint32_t          *child;
        uint32_t                index;
        const uint64_t          *fid;
@@ -108,7 +99,7 @@ static bool get_child_folders_pf(TALLOC_CTX *mem_ctx, mapi_object_t *parent, map
        if (retval != MAPI_E_SUCCESS) return false;
 
        SPropTagArray = set_SPropTagArray(mem_ctx, 0x3,
-                                         PR_DISPLAY_NAME,
+                                         PR_DISPLAY_NAME_UNICODE,
                                          PR_FID,
                                          PR_FOLDER_CHILD_COUNT);
        retval = SetColumns(&obj_htable, SPropTagArray);
@@ -118,15 +109,13 @@ static bool get_child_folders_pf(TALLOC_CTX *mem_ctx, mapi_object_t *parent, map
        while (((retval = QueryRows(&obj_htable, 0x32, TBL_ADVANCE, &rowset)) != MAPI_E_NOT_FOUND) && rowset.cRows) {
                for (index = 0; index < rowset.cRows; index++) {
                        fid = (const uint64_t *)find_SPropValue_data(&rowset.aRow[index], PR_FID);
-                       name = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME);
+                       name = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME_UNICODE);
                        child = (const uint32_t *)find_SPropValue_data(&rowset.aRow[index], PR_FOLDER_CHILD_COUNT);
 
                        for (i = 0; i < count; i++) {
                                printf("|   ");
                        }
-                       newname = utf8tolinux(mem_ctx, name);
-                       printf("|---+ %-15s\n", newname);
-                       MAPIFreeBuffer(newname);
+                       printf("|---+ %-15s\n", name);
                        if (*child) {
                                ret = get_child_folders_pf(mem_ctx, &obj_folder, *fid, count + 1);
                                if (ret == false) return ret;
@@ -146,7 +135,6 @@ static enum MAPISTATUS openchangepfadmin_getdir(TALLOC_CTX *mem_ctx,
        struct SPropTagArray    *SPropTagArray;
        struct SRowSet          rowset;
        mapi_object_t           obj_htable;
-       char                    *newname;
        const char              *name;
        const uint64_t          *fid;
        uint32_t                index;
@@ -156,7 +144,7 @@ static enum MAPISTATUS openchangepfadmin_getdir(TALLOC_CTX *mem_ctx,
        MAPI_RETVAL_IF(retval, GetLastError(), NULL);
 
        SPropTagArray = set_SPropTagArray(mem_ctx, 0x2,
-                                         PR_DISPLAY_NAME,
+                                         PR_DISPLAY_NAME_UNICODE,
                                          PR_FID);
        retval = SetColumns(&obj_htable, SPropTagArray);
        MAPIFreeBuffer(SPropTagArray);
@@ -165,15 +153,13 @@ static enum MAPISTATUS openchangepfadmin_getdir(TALLOC_CTX *mem_ctx,
        while (((retval = QueryRows(&obj_htable, 0x32, TBL_ADVANCE, &rowset)) != MAPI_E_NOT_FOUND) && rowset.cRows) {
                for (index = 0; index < rowset.cRows; index++) {
                        fid = (const uint64_t *)find_SPropValue_data(&rowset.aRow[index], PR_FID);
-                       name = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME);
+                       name = (const char *)find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME_UNICODE);
 
-                       newname = utf8tolinux(mem_ctx, name);
-                       if (newname && fid && !strcmp(newname, folder)) {
+                       if (name && fid && !strcmp(name, folder)) {
                                retval = OpenFolder(obj_container, *fid, obj_child);
                                MAPI_RETVAL_IF(retval, GetLastError(), NULL);
                                return MAPI_E_SUCCESS;
                        }
-                       MAPIFreeBuffer(newname);
                }
        }