Small Business Server 2003 SP2 (which is basically exchange 2003 SP2, if I
understand it correctly)
wants to speak french to me. That is unfortunate, because I'm monolingual.
I've added an option to mapiprofile to allow you to specify the language code
to use, instead of
always defaulting to 0x40C (which is fr-FR). We now default to en-US, and you
use the --langcode
option to specify something else.
You can see this behaviour below (using fr-FR and de-DE).
[EMAIL PROTECTED] octrunk]$ mapiprofile -n
[EMAIL PROTECTED] octrunk]$
mapiprofile --profile=testuser1 --username=TestUser1 --password=testuser1
--address=192.168.11.77 --workstation=LOCALHOST --domain=OPENCHANGE-TEST
--create
nspi_QueryRows success
Profile testuser1 completed and added to database
/home/bradh/.openchange/profiles.ldb
[EMAIL PROTECTED] octrunk]$ openchangeclient --profile=testuser1 -m
+ Mailbox - Test User1
|---+ Calendar : (Total: 0 / Unread: 0 - Container
class: IPF.Appointment) [FID: 0xc13e000000000001]
|---+ Contacts : (Total: 0 / Unread: 0 - Container
class: IPF.Contact) [FID: 0xc23e000000000001]
|---+ Deleted Items : (Total: 0 / Unread: 0 - Container
class: IPF.Note) [FID: 0xe350000000000001]
|---+ Drafts : (Total: 0 / Unread: 0 - Container
class: IPF.Note) [FID: 0xc33e000000000001]
|---+ Inbox : (Total: 2 / Unread: 2 - Container
class: IPF.Note) [FID: 0xe050000000000001]
|---+ Journal : (Total: 0 / Unread: 0 - Container
class: IPF.Journal) [FID: 0xc43e000000000001]
|---+ Notes : (Total: 0 / Unread: 0 - Container
class: IPF.StickyNote) [FID: 0xc53e000000000001]
|---+ Outbox : (Total: 0 / Unread: 0 - Container
class: IPF.Note) [FID: 0xe150000000000001]
|---+ Sent Items : (Total: 0 / Unread: 0 - Container
class: IPF.Note) [FID: 0xe250000000000001]
|---+ Tasks : (Total: 0 / Unread: 0 - Container
class: IPF.Task) [FID: 0xc63e000000000001]
mailbox : MAPI_E_SUCCESS (0x0)
[EMAIL PROTECTED] octrunk]$
mapiprofile --profile=testuser2 --username=TestUser2 --password=testuser2
--langcode=0x040C --address=192.168.11.77 --workstation=LOCALHOST
--domain=OPENCHANGE-TEST --create
nspi_QueryRows success
Profile testuser2 completed and added to database
/home/bradh/.openchange/profiles.ldb
[EMAIL PROTECTED] octrunk]$ openchangeclient --profile=testuser2 -m
+ Boîte aux lettres - Test User2
|---+ Boîte de réception : (Total: 2 / Unread: 2 -
Container class: IPF.Note) [FID: 0x1a55000000000001]
|---+ Boîte d'envoi : (Total: 0 / Unread: 0 - Container
class: IPF.Note) [FID: 0x1b55000000000001]
|---+ Brouillons : (Total: 0 / Unread: 0 - Container
class: IPF.Note) [FID: 0xc93e000000000001]
|---+ Calendrier : (Total: 0 / Unread: 0 - Container
class: IPF.Appointment) [FID: 0xc73e000000000001]
|---+ Contacts : (Total: 0 / Unread: 0 - Container
class: IPF.Contact) [FID: 0xc83e000000000001]
|---+ Éléments envoyés : (Total: 0 / Unread: 0 - Container
class: IPF.Note) [FID: 0x1c55000000000001]
|---+ Éléments supprimés : (Total: 0 / Unread: 0 -
Container class: IPF.Note) [FID: 0x1d55000000000001]
|---+ Journal : (Total: 0 / Unread: 0 - Container
class: IPF.Journal) [FID: 0xca3e000000000001]
|---+ Notes : (Total: 0 / Unread: 0 - Container
class: IPF.StickyNote) [FID: 0xcb3e000000000001]
|---+ Tâches : (Total: 0 / Unread: 0 - Container
class: IPF.Task) [FID: 0xcc3e000000000001]
mailbox : MAPI_E_SUCCESS (0x0)
[EMAIL PROTECTED] octrunk]$
mapiprofile --profile=testuser3 --username=TestUser3 --password=testuser3
--langcode=0x0407 --address=192.168.11.77 --workstation=LOCALHOST
--domain=OPENCHANGE-TEST --create
nspi_QueryRows success
Profile testuser3 completed and added to database
/home/bradh/.openchange/profiles.ldb
[EMAIL PROTECTED] octrunk]$ openchangeclient --profile=testuser3 -m
+ Postfach - Test User3
|---+ Aufgaben : (Total: 0 / Unread: 0 - Container
class: IPF.Task) [FID: 0xd23e000000000001]
|---+ Entwürfe : (Total: 0 / Unread: 0 - Container
class: IPF.Note) [FID: 0xcf3e000000000001]
|---+ Gelöschte Objekte : (Total: 0 / Unread: 0 -
Container class: IPF.Note) [FID: 0x5759000000000001]
|---+ Gesendete Objekte : (Total: 0 / Unread: 0 -
Container class: IPF.Note) [FID: 0x5659000000000001]
|---+ Journal : (Total: 0 / Unread: 0 - Container
class: IPF.Journal) [FID: 0xd03e000000000001]
|---+ Kalender : (Total: 0 / Unread: 0 - Container
class: IPF.Appointment) [FID: 0xcd3e000000000001]
|---+ Kontakte : (Total: 0 / Unread: 0 - Container
class: IPF.Contact) [FID: 0xce3e000000000001]
|---+ Notizen : (Total: 0 / Unread: 0 - Container
class: IPF.StickyNote) [FID: 0xd13e000000000001]
|---+ Postausgang : (Total: 0 / Unread: 0 - Container
class: IPF.Note) [FID: 0x5559000000000001]
|---+ Posteingang : (Total: 2 / Unread: 2 - Container
class: IPF.Note) [FID: 0x5459000000000001]
mailbox : MAPI_E_SUCCESS (0x0)
Patch is attached. Please apply.
Brad
Index: utils/mapiprofile.c
===================================================================
--- utils/mapiprofile.c (revision 361)
+++ utils/mapiprofile.c (working copy)
@@ -27,6 +27,7 @@
#define DEFAULT_DIR "%s/.openchange"
#define DEFAULT_PROFDB "%s/.openchange/profiles.ldb"
+#define DEFAULT_LCID "0x409" /* language code ID: en-US */
static void mapiprofile_createdb(const char *profdb, const char *ldif_path)
{
@@ -73,8 +74,9 @@
static void mapiprofile_create(const char *profdb, const char *profname,
const char *pattern, const char *username,
const char *password, const char *address,
- const char *workstation, const char *domain,
- uint32_t flags, bool opt_dumpdata)
+ const char *lcid, const char *workstation,
+ const char *domain, uint32_t flags,
+ bool opt_dumpdata)
{
enum MAPISTATUS retval;
struct mapi_session *session = NULL;
@@ -102,7 +104,7 @@
/* This is only convenient here and should be replaced at some point */
mapi_profile_add_string_attr(profname, "codepage", "0x4e4");
- mapi_profile_add_string_attr(profname, "language", "0x40c");
+ mapi_profile_add_string_attr(profname, "language", lcid );
mapi_profile_add_string_attr(profname, "method", "0x409");
retval = MapiLogonProvider(&session, profname, password, PROVIDER_ID_NSPI);
@@ -331,6 +333,7 @@
const char *workstation = NULL;
const char *domain = NULL;
const char *username = NULL;
+ const char *lcid = NULL;
const char *pattern = NULL;
const char *password = NULL;
const char *profdb = NULL;
@@ -339,7 +342,7 @@
uint32_t nopass = 0;
enum {OPT_PROFILE_DB=1000, OPT_PROFILE, OPT_ADDRESS, OPT_WORKSTATION,
- OPT_DOMAIN, OPT_USERNAME, OPT_PASSWORD, OPT_CREATE_PROFILE,
+ OPT_DOMAIN, OPT_USERNAME, OPT_LCID, OPT_PASSWORD, OPT_CREATE_PROFILE,
OPT_DELETE_PROFILE, OPT_LIST_PROFILE, OPT_DUMP_PROFILE,
OPT_DUMP_ATTR, OPT_PROFILE_NEWDB, OPT_PROFILE_LDIF,
OPT_PROFILE_SET_DFLT, OPT_PROFILE_GET_DFLT, OPT_PATTERN,
@@ -353,10 +356,11 @@
{"newdb", 'n', POPT_ARG_NONE, NULL, OPT_PROFILE_NEWDB, "create a new profile store"},
{"database", 'f', POPT_ARG_STRING, NULL, OPT_PROFILE_DB, "set the profile database path"},
{"profile", 'P', POPT_ARG_STRING, NULL, OPT_PROFILE, "set the profile name"},
- {"address", 'I', POPT_ARG_STRING, NULL, OPT_ADDRESS, "set the exchange server address"},
+ {"address", 'I', POPT_ARG_STRING, NULL, OPT_ADDRESS, "set the exchange server IP address"},
{"workstation", 'M', POPT_ARG_STRING, NULL, OPT_WORKSTATION, "set the workstation"},
{"domain", 'D', POPT_ARG_STRING, NULL, OPT_DOMAIN, "set the domain"},
{"username", 'u', POPT_ARG_STRING, NULL, OPT_USERNAME, "set the profile username"},
+ {"langcode", 'C', POPT_ARG_STRING, NULL, OPT_LCID, "set the language code ID"},
{"pattern", 's', POPT_ARG_STRING, NULL, OPT_PATTERN, "username to search"},
{"password", 'p', POPT_ARG_STRING, NULL, OPT_PASSWORD, "set the profile password"},
{"nopass", 0, POPT_ARG_NONE, NULL, OPT_NOPASS, "do not save password in the profile"},
@@ -407,6 +411,9 @@
case OPT_USERNAME:
username = poptGetOptArg(pc);
break;
+ case OPT_LCID:
+ lcid = poptGetOptArg(pc);
+ break;
case OPT_PATTERN:
pattern = poptGetOptArg(pc);
break;
@@ -472,8 +479,11 @@
if (!workstation) show_help(pc, "workstation");
if (!domain) show_help(pc, "domain");
+ if (!lcid) {
+ lcid = talloc_asprintf(mem_ctx, DEFAULT_LCID);
+ }
mapiprofile_create(profdb, profname, pattern, username, password, address,
- workstation, domain, nopass, opt_dumpdata);
+ lcid, workstation, domain, nopass, opt_dumpdata);
}
if (setdflt == true) {
Index: doc/man/man1/mapiprofile.1
===================================================================
--- doc/man/man1/mapiprofile.1 (revision 361)
+++ doc/man/man1/mapiprofile.1 (working copy)
@@ -143,6 +143,13 @@
Set the password matching with the username described above
.TP
+.B --langcode
+.TP
+.B -C
+Specify the language code to use with the account. The default
+language code is 0x0409, for US English.
+
+.TP
.B --pattern
.TP
.B -s
@@ -160,10 +167,11 @@
.B Create a new profile:
.nf
mapiprofile --database=/tmp/profiles.ldb --profile=jkerihuel
- --username=jkerihuel --password=secret
+ --username=jkerihuel --password=secret --langcode=0x040C
--address=192.168.194.22 --workstation=LOCALHOST --domain=OPENCHANGE
--create
-Profile jkerihuel completed and added to database /tmp/profiles.ldb
+Profile jkerihuel completed and added to database /tmp/profiles.ldb. Note
+that this account will use French.
.fi
.B Delete a profile:
@@ -200,3 +208,8 @@
.SH AUTHOR
Julien Kerihuel <j.kerihuel at openchange dot org>
+
+.SH "SEE ALSO"
+The codes for various languages can be found in many places, including
+the Windows Language Code Identifier (LCID) Reference.
+
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel