OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [libgui/] [src/] [tclmapi.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* tclmapi.c - Tcl interface to MAPI.
2
   Copyright (C) 1997 Cygnus Solutions
3
   Written by Tom Tromey <tromey@cygnus.com>.  */
4
 
5
#ifdef _WIN32
6
 
7
#include <windows.h>
8
#include <mapi.h>
9
 
10
#include <stdio.h>
11
#include <tcl.h>
12
 
13
#include "guitcl.h"
14
#include "subcommand.h"
15
 
16
/* Usage for the mapi command:
17
   mapi simple-send TO-ADDRESS SUBJECT TEXT.
18
 
19
   This command has been deliberately kept very simple; it only does
20
   what we need.  However it can be extended by adding new subcommands
21
   if necessary.  */
22
 
23
static int
24
mapi_command (ClientData cd, Tcl_Interp *interp, int argc, char *argv[])
25
{
26
  MapiMessage message;
27
  MapiRecipDesc to;
28
  ULONG result;
29
 
30
  message.ulReserved = 0;
31
  message.lpszSubject = argv[3];
32
  message.lpszNoteText = argv[4];
33
  message.lpszMessageType = NULL;
34
  message.lpszDateReceived = NULL;
35
  message.lpszConversationID = NULL;
36
  message.flFlags = 0;
37
  message.lpOriginator = NULL;
38
  message.nRecipCount = 1;
39
  message.lpRecips = &to;
40
  message.nFileCount = 0;
41
  message.lpFiles = NULL;
42
 
43
  to.ulReserved = 0;
44
  to.ulRecipClass = MAPI_TO;
45
  to.lpszName = "";
46
  /* FIXME: smtp:address?  */
47
  to.lpszAddress = argv[2];
48
  to.ulEIDSize = 0;
49
  to.lpEntryID = NULL;
50
 
51
  result = MAPISendMail (0, 0, &message, MAPI_LOGON_UI, 0);
52
  if (result != SUCCESS_SUCCESS)
53
    {
54
      /* We could decode the error here.  */
55
      char buf[20];
56
 
57
      sprintf (buf, "0x%lx", result);
58
      Tcl_AppendResult (interp, argv[0], ": failed with status ",
59
                        buf, (char *) NULL);
60
      return TCL_ERROR;
61
    }
62
 
63
  return TCL_OK;
64
}
65
 
66
static const struct ide_subcommand_table mapi_table[] =
67
{
68
  { "simple-send", mapi_command, 5, 5 },
69
  { NULL, NULL, 0, 0 }
70
};
71
 
72
int
73
ide_create_mapi_command (Tcl_Interp *interp)
74
{
75
  return ide_create_command_with_subcommands (interp, "ide_mapi",
76
                                              mapi_table, NULL, NULL);
77
}
78
 
79
#endif /* _WIN32 */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.