/* * Append selected search results to an address folder view. * This is called as result of dragging from the LDAP search view * to a compose window address area. */ void XFE_LdapSearchView::addSelectedToAddressPane(XFE_AddressFolderView* addr, SEND_STATUS fieldStatus) { int count = 0; const int *indices = 0; m_outliner->getSelection(&indices, &count); if (count==0) return; /* pack selected */ ABAddrMsgCBProcStruc *pairs = (ABAddrMsgCBProcStruc *) XP_CALLOC(1,sizeof(ABAddrMsgCBProcStruc)); pairs->m_pairs = (StatusID_t **) XP_CALLOC(count, sizeof(StatusID_t*)); MSG_ResultElement *resultLine = NULL; for (int i=0; i < count; i++) { if (SearchError_Success != MSG_GetResultElement(getPane(), indices[i], &resultLine)) continue; StatusID_t *pair; pair = (StatusID_t *) XP_CALLOC(1, sizeof(StatusID_t)); pair->status = fieldStatus; pair->type = ABTypePerson; // email MSG_SearchValue *result; if ((SearchError_Success == MSG_GetResultAttribute(resultLine,attrib822Address,&result))&& result && result->u.string) { pair->emailAddr = XP_STRDUP(result->u.string); MSG_DestroySearchValue(result); } // fullname MSG_GetResultAttribute(resultLine, attribCommonName, &result); // assemble if (strlen(pair->emailAddr) && result && result->u.string) { char tmp[AB_MAX_STRLEN]; sprintf(tmp, "%s <%s>", result->u.string, pair->emailAddr); pair->dplyStr = XP_STRDUP(tmp); MSG_DestroySearchValue(result); } else pair->dplyStr = XP_STRDUP(result->u.string); pairs->m_pairs[pairs->m_count] = pair; (pairs->m_count)++; } if (pairs && pairs->m_count) { addr->addrMsgCB(pairs); } }
int XFE_ABDirListView::ProcessTargets(int row, int col, Atom *targets, const char **data, int numItems) { int i; D(("XFE_ABDirListView::ProcessTargets(row=%d, col=%d, numItems=%d)\n", row, col, numItems)); for (i=0; i < numItems; i++) { if (targets[i]==None || data[i]==NULL || strlen(data[i])==0) continue; D((" [%d] %s: \"%s\"\n",i,XmGetAtomName(XtDisplay(m_widget),targets[i]),data[i])); if (targets[i] == XFE_OutlinerDrop::_XA_NETSCAPE_DIRSERV) { #if defined(DEBUG_tao) printf("\nXFE_ABDirListView::ProcessTargets:_XA_NETSCAPE_DIRSERV\n"); #endif /* decode */ char *pStr = (char *) XP_STRDUP(data[i]); int len = XP_STRLEN(pStr); uint32 pCount = 0; char tmp[32]; sscanf(data[i], "%d", &pCount); int *indices = (int *) XP_CALLOC(pCount, sizeof(int)); char *tok = 0, *last = 0; int count = 0; char *sep = " "; while (((tok=XP_STRTOK_R(count?nil:pStr, sep, &last)) != NULL)&& XP_STRLEN(tok) && count < len) { int index = atoi(tok); if (!count) XP_ASSERT(index == pCount); else indices[count-1] = index; count++; }/* while */ return TRUE; }/* if */ else if (targets[i] == XFE_OutlinerDrop::_XA_NETSCAPE_PAB) { D((" [%d] %s: \"%s\"\n",i,XmGetAtomName(XtDisplay(m_widget),targets[i]),data[i])); #if defined(DEBUG_tao) printf("\nXFE_ABDirListView::ProcessTargets:_XA_NETSCAPE_PAB\n"); #endif return TRUE; }/* elss if */ }/* for i */ return FALSE; }
JNIUtilCtxt* makeJNIUtil( MPFORMAL JNIEnv** envp, jobject jniutls ) { JNIUtilCtxt* ctxt = (JNIUtilCtxt*)XP_CALLOC( mpool, sizeof( *ctxt ) ); JNIEnv* env = *envp; ctxt->envp = envp; ctxt->jjniutil = (*env)->NewGlobalRef( env, jniutls ); MPASSIGN( ctxt->mpool, mpool ); return ctxt; }
/* Must remain idempotent. Also used to make sure that the ic->quantize has the same colorSpace info as the rest of ic. */ int il_init_quantize(il_container *ic) { size_t arraysize; int i, j; my_cquantize_ptr cquantize; if (ic->quantize) il_free_quantize(ic); ic->quantize = XP_NEW_ZAP(my_cquantize); if (!ic->quantize) { loser: ILTRACE(0,("il: MEM il_init_quantize")); return FALSE; } cquantize = (my_cquantize_ptr) ic->quantize; arraysize = (size_t) ((ic->image->header.width + 2) * SIZEOF(FSERROR)); for (i = 0; i < 3; i++) { cquantize->fserrors[i] = (FSERRPTR) XP_CALLOC(1, arraysize); if (!cquantize->fserrors[i]) { /* ran out of memory part way thru */ for (j = 0; j < i; j++) { if (cquantize->fserrors[j]) { XP_FREE(cquantize->fserrors[j]); cquantize->fserrors[j]=0; } } if (cquantize) { XP_FREE(cquantize); ic->quantize = 0; } goto loser; } } return TRUE; }
XW_UtilCtxt* makeUtil( MPFORMAL JNIEnv** envp, jobject jutil, CurGameInfo* gi, AndGlobals* closure ) { AndUtil* util = (AndUtil*)XP_CALLOC( mpool, sizeof(*util) ); UtilVtable* vtable = (UtilVtable*)XP_CALLOC( mpool, sizeof(*vtable) ); util->env = envp; JNIEnv* env = *envp; if ( NULL != jutil ) { util->jutil = (*env)->NewGlobalRef( env, jutil ); } util->util.vtable = vtable; MPASSIGN( util->util.mpool, mpool ); util->util.closure = closure; util->util.gameInfo = gi; #define SET_PROC(nam) vtable->m_util_##nam = and_util_##nam SET_PROC(getVTManager); #ifndef XWFEATURE_STANDALONE_ONLY SET_PROC(makeStreamFromAddr); #endif SET_PROC(getSquareBonus); SET_PROC(userError); SET_PROC(userQuery); SET_PROC(confirmTrade); SET_PROC(userPickTileBlank); SET_PROC(userPickTileTray); SET_PROC(askPassword); SET_PROC(trayHiddenChange); SET_PROC(yOffsetChange); #ifdef XWFEATURE_TURNCHANGENOTIFY SET_PROC(turnChanged); #endif SET_PROC(informMove); SET_PROC(informUndo); SET_PROC(informNetDict); SET_PROC(notifyGameOver); #ifdef XWFEATURE_HILITECELL SET_PROC(hiliteCell); #endif SET_PROC(engineProgressCallback); SET_PROC(setTimer); SET_PROC(clearTimer); SET_PROC(requestTime); SET_PROC(altKeyDown); SET_PROC(getCurSeconds); SET_PROC(makeEmptyDict); SET_PROC(getUserString); SET_PROC(warnIllegalWord); SET_PROC(showChat); SET_PROC(remSelected); #ifndef XWFEATURE_MINIWIN SET_PROC(bonusSquareHeld); SET_PROC(playerScoreHeld); SET_PROC(noHintAvailable); SET_PROC(androidExchangedTiles); SET_PROC(androidNoMove); #endif #ifdef XWFEATURE_SMS SET_PROC(phoneNumbersSame); #endif #ifdef XWFEATURE_BOARDWORDS SET_PROC(cellSquareHeld); #endif #ifndef XWFEATURE_STANDALONE_ONLY SET_PROC(informMissing); SET_PROC(addrChange); SET_PROC(setIsServer); # ifdef XWFEATURE_DEVID SET_PROC(getDevID); SET_PROC(deviceRegistered); # endif #endif #ifdef XWFEATURE_SEARCHLIMIT SET_PROC(getTraySearchLimits); #endif #ifdef SHOW_PROGRESS SET_PROC(engineStarting); SET_PROC(engineStopping); #endif #undef SET_PROC return (XW_UtilCtxt*)util; } /* makeUtil */
// tooltips and doc string char *XFE_AddrBookView::getDocString(CommandType cmd) { uint32 count = 0; const int *indices = 0; m_outliner->getSelection(&indices, (int *) &count); if (count > 0) { char *names = 0; char a_line[512]; a_line[0] = '\0'; int len = 0; for (int i=0; i < count && len < 512; i++) { /* Take the first one */ #if defined(USE_ABCOM) AB_AttributeValue *value = NULL; int error = AB_GetEntryAttributeForPane(m_pane, (MSG_ViewIndex) indices[i], AB_attribFullName, &value); XP_ASSERT(value && value->attrib == AB_attribFullName); XP_SAFE_SPRINTF(a_line, sizeof(a_line), "%s", value->u.string?value->u.string:""); AB_FreeEntryAttributeValue(value); #else ABID entry; entry = AB_GetEntryIDAt((AddressPane *) m_abPane, (uint32) indices[i]); AB_GetFullName(m_dir, m_AddrBook, entry, a_line); #endif /* USE_ABCOM */ if (a_line) { len += XP_STRLEN(a_line); if (i) len += 2; names = names? ((char *) XP_REALLOC(names, (len+1)*sizeof(char))): ((char *) XP_CALLOC(1+len, sizeof(char))); if (i) names = XP_STRCAT(names, ", "); names = XP_STRCAT(names, a_line); }/* if */ }/* for i */ char *cstr = 0; if (cmd == xfeCmdComposeMessage || cmd == xfeCmdComposeMessageHTML || cmd == xfeCmdComposeMessagePlain) { cstr = XP_STRDUP(XP_GetString(XFE_SEND_MSG_TO)); } else if (cmd == xfeCmdABCall) { cstr = XP_STRDUP(XP_GetString(XFE_PLACE_CONFERENCE_CALL_TO)); } len += XP_STRLEN(cstr); cstr = (char *) XP_REALLOC(cstr, (1+len)*sizeof(char)); cstr = (char *) XP_STRCAT(cstr, names); return cstr; }/* if */ return NULL; }
void XFE_ABNameGenTabView::getDlgValues() { #if defined(DEBUG_tao_) printf("\n XFE_ABNameGenTabView::getDlgValues \n"); #endif XFE_ABNameFolderDlg *dlg = (XFE_ABNameFolderDlg *)getToplevel(); #if defined(USE_ABCOM) XFE_PropertySheetView *folderView = (XFE_PropertySheetView *) getParent(); MSG_Pane *pane = folderView->getPane(); uint16 numItems = AB_LAST+1; AB_AttributeValue *values = (AB_AttributeValue *) XP_CALLOC(numItems, sizeof(AB_AttributeValue)); char *tmp = NULL; // tmp = fe_GetTextField(m_textFs[AB_FIRST_NAME]); values[AB_FIRST_NAME].attrib = AB_attribGivenName; if (tmp && strlen(tmp)) values[AB_FIRST_NAME].u.string = tmp; else values[AB_FIRST_NAME].u.string = XP_STRDUP(""); // tmp = fe_GetTextField(m_textFs[AB_LAST_NAME]); values[AB_LAST_NAME].attrib = AB_attribFamilyName; if (tmp && strlen(tmp)) values[AB_LAST_NAME].u.string = tmp; else values[AB_LAST_NAME].u.string = XP_STRDUP(""); // AB_attribInfo tmp = fe_GetTextField(m_notesTxt); values[AB_DISPLAY_NAME].attrib = AB_attribInfo; if (tmp && strlen(tmp)) values[AB_DISPLAY_NAME].u.string = tmp; else values[AB_DISPLAY_NAME].u.string = XP_STRDUP(""); // tmp = fe_GetTextField(m_textFs[AB_EMAIL]); values[AB_EMAIL].attrib = AB_attribEmailAddress; if (tmp && strlen(tmp)) values[AB_EMAIL].u.string = tmp; else values[AB_EMAIL].u.string = XP_STRDUP(""); // tmp = fe_GetTextField(m_textFs[AB_NICKNAME]); values[AB_NICKNAME].attrib = AB_attribNickName; if (tmp && strlen(tmp)) values[AB_NICKNAME].u.string = tmp; else values[AB_NICKNAME].u.string = XP_STRDUP(""); // tmp = fe_GetTextField(m_textFs[AB_TITLE]); values[AB_TITLE].attrib = AB_attribTitle; if (tmp && strlen(tmp)) values[AB_TITLE].u.string = tmp; else values[AB_TITLE].u.string = XP_STRDUP(""); // tmp = fe_GetTextField(m_textFs[AB_COMPANY_NAME]); values[AB_COMPANY_NAME].attrib = AB_attribCompanyName; if (tmp && strlen(tmp)) values[AB_COMPANY_NAME].u.string = tmp; else values[AB_COMPANY_NAME].u.string = XP_STRDUP(""); // values[AB_LAST].u.boolValue = XmToggleButtonGetState(m_prefHTMLTog); values[AB_LAST].attrib = AB_attribHTMLMail; //set values int error = AB_SetPersonEntryAttributes(pane, values, numItems); AB_FreeEntryAttributeValues(values, numItems); #else PersonEntry& entry = dlg->getPersonEntry(); /* setting up the defaults */ char *tmp; tmp = fe_GetTextField(m_textFs[AB_NICKNAME]); if (tmp && strlen(tmp)) entry.pNickName = tmp; else entry.pNickName = XP_STRDUP(""); tmp = fe_GetTextField(m_textFs[AB_FIRST_NAME]); if (tmp && strlen(tmp)) entry.pGivenName = tmp; else entry.pGivenName = XP_STRDUP(""); tmp = fe_GetTextField(m_textFs[AB_LAST_NAME]); if (tmp && strlen(tmp)) entry.pFamilyName = tmp; else entry.pFamilyName = XP_STRDUP(""); tmp = fe_GetTextField(m_textFs[AB_COMPANY_NAME]); if (tmp && strlen(tmp)) entry.pCompanyName = tmp; else entry.pCompanyName = XP_STRDUP(""); tmp = fe_GetTextField(m_textFs[AB_TITLE]); if (tmp && strlen(tmp)) entry.pTitle = tmp; else entry.pTitle = XP_STRDUP(""); tmp = fe_GetTextField(m_textFs[AB_EMAIL]); if (tmp && strlen(tmp)) entry.pEmailAddress = fe_GetTextField(m_textFs[AB_EMAIL]); else entry.pEmailAddress = XP_STRDUP(""); tmp = fe_GetTextField(m_notesTxt); if (tmp && strlen(tmp)) entry.pInfo = tmp; else entry.pInfo = XP_STRDUP(""); entry.HTMLmail = XmToggleButtonGetState(m_prefHTMLTog); #endif /* USE_ABCOM */ // set title if (tmp = dlg->getFullname()) { char tmp2[AB_MAX_STRLEN]; XP_SAFE_SPRINTF(tmp2, sizeof(tmp2), XP_GetString(XFE_AB_NAME_CARD_FOR), tmp); dlg->setCardName(tmp2); XP_FREE((char *) tmp); }/* if */ else dlg->setCardName(XP_GetString(XFE_AB_NAME_NEW_CARD)); }
void XFE_ABNameGenTabView::setDlgValues() { /* Get mode, entryid, and ab_view */ XFE_ABNameFolderDlg *dlg = (XFE_ABNameFolderDlg *)getToplevel(); #if defined(USE_ABCOM) XFE_PropertySheetView *folderView = (XFE_PropertySheetView *) getParent(); MSG_Pane *pane = folderView->getPane(); uint16 numItems = AB_LAST+2; AB_AttribID * attribs = (AB_AttribID *) XP_CALLOC(numItems, sizeof(AB_AttribID)); attribs[AB_FIRST_NAME] = AB_attribGivenName; attribs[AB_LAST_NAME] = AB_attribFamilyName; attribs[AB_DISPLAY_NAME] = AB_attribDisplayName; attribs[AB_EMAIL] = AB_attribEmailAddress; attribs[AB_NICKNAME] = AB_attribNickName; attribs[AB_TITLE] = AB_attribTitle; attribs[AB_COMPANY_NAME] = AB_attribCompanyName; attribs[AB_LAST] = AB_attribInfo; attribs[AB_LAST+1] = AB_attribHTMLMail; AB_AttributeValue *values = NULL; int error = AB_GetPersonEntryAttributes(pane, attribs, &values, &numItems); char *tmp = NULL; for (int i=0; i < numItems; i++) { switch (values[i].attrib) { case AB_attribGivenName: tmp = values[i].u.string; fe_SetTextField(m_textFs[AB_FIRST_NAME], tmp?tmp:""); break; case AB_attribFamilyName: tmp = values[i].u.string; fe_SetTextField(m_textFs[AB_LAST_NAME], tmp?tmp:""); break; case AB_attribDisplayName: tmp = values[i].u.string; fe_SetTextField(m_textFs[AB_DISPLAY_NAME], tmp?tmp:""); break; case AB_attribEmailAddress: tmp = values[i].u.string; fe_SetTextField(m_textFs[AB_EMAIL], tmp?tmp:""); break; case AB_attribNickName: tmp = values[i].u.string; fe_SetTextField(m_textFs[AB_NICKNAME], tmp?tmp:""); break; case AB_attribTitle: tmp = values[i].u.string; fe_SetTextField(m_textFs[AB_TITLE], tmp?tmp:""); break; case AB_attribCompanyName: tmp = values[i].u.string; fe_SetTextField(m_textFs[AB_COMPANY_NAME], tmp?tmp:""); break; case AB_attribInfo: // AB_attribInfo tmp = values[i].u.string; fe_SetTextField(m_notesTxt, tmp?tmp:""); break; case AB_attribHTMLMail: XmToggleButtonSetState(m_prefHTMLTog, values[i].u.boolValue, FALSE); break; }/* switch */ }/* for i */ XP_FREEIF(attribs); AB_FreeEntryAttributeValues(values, numItems); #else PersonEntry& entry = dlg->getPersonEntry(); fe_SetTextField(m_textFs[AB_FIRST_NAME], entry.pGivenName?entry.pGivenName:""); fe_SetTextField(m_textFs[AB_LAST_NAME], entry.pFamilyName?entry.pFamilyName:""); fe_SetTextField(m_textFs[AB_COMPANY_NAME], entry.pCompanyName?entry.pCompanyName:""); fe_SetTextField(m_textFs[AB_TITLE], entry.pTitle?entry.pTitle:""); fe_SetTextField(m_textFs[AB_EMAIL], entry.pEmailAddress?entry.pEmailAddress:""); fe_SetTextField(m_textFs[AB_NICKNAME], entry.pNickName?entry.pNickName:""); fe_SetTextField(m_notesTxt, entry.pInfo?entry.pInfo:""); XmToggleButtonSetState(m_prefHTMLTog, entry.HTMLmail, FALSE); #endif /* USE_ABCOM */ }
// // This function will create a composition window and either do // a blind send or pop up the compose window for the user to // complete the operation // // Return: appropriate MAPI return code... // // extern "C" LONG DoFullMAPIMailOperation(MAPISendMailType *sendMailPtr, const char *pInitialText, BOOL winShowFlag) { CGenericDoc *pDocument; LPSTR subject; NSstringSeq mailInfoSeq; DWORD stringCount = 6; DWORD i; CString csDefault; // Get a context to use for this call... MWContext *pOldContext = GetUsableContext(); if (!pOldContext) { return(MAPI_E_FAILURE); } // Don't allow a compose window to be created if the user hasn't // specified an email address const char *real_addr = FE_UsersMailAddress(); if (MISC_ValidateReturnAddress(pOldContext, real_addr) < 0) { return(MAPI_E_FAILURE); } // // Now, we must build the fields object... // mailInfoSeq = (NSstringSeq) &(sendMailPtr->dataBuf[0]); subject = NSStrSeqGet(mailInfoSeq, 0); // We should give it a subject to preven the prompt from coming // up... if ((!subject) || !(*subject)) { csDefault.LoadString(IDS_COMPOSE_DEFAULTNOSUBJECT); subject = csDefault.GetBuffer(2); } TRACE("MAPI: ProcessMAPISendMail() Subject = [%s]\n", subject); TRACE("MAPI: ProcessMAPISendMail() Text Size = [%d]\n", strlen((const char *)pInitialText)); TRACE("MAPI: ProcessMAPISendMail() # of Recipients = [%d]\n", sendMailPtr->MSG_nRecipCount); char toString[1024] = ""; char ccString[1024] = ""; char bccString[1024] = ""; for (i=0; i<sendMailPtr->MSG_nRecipCount; i++) { LPSTR ptr; UCHAR tempString[256]; ULONG addrType = atoi(NSStrSeqGet(mailInfoSeq, stringCount++)); // figure which type of address this is? if (addrType == MAPI_CC) ptr = ccString; else if (addrType == MAPI_BCC) ptr = bccString; else ptr = toString; LPSTR namePtr = (LPSTR) NSStrSeqGet(mailInfoSeq, stringCount++); LPSTR emailPtr = (LPSTR) NSStrSeqGet(mailInfoSeq, stringCount++); if ( (lstrlen(emailPtr) > 5) && (*(emailPtr + 4) == ':') ) { emailPtr += 5; } // Now build the temp string to tack on in the format // "Rich Pizzarro" <*****@*****.**> wsprintf((LPSTR) tempString, "\"%s\" <%s>", namePtr, emailPtr); // add a comma if not the first one if (ptr[0] != '\0') lstrcat(ptr, ","); // tack on string! lstrcat(ptr, (LPSTR) tempString); } BOOL bEncrypt = FALSE; BOOL bSign = FALSE; PREF_GetBoolPref("mail.crypto_sign_outgoing_mail", &bSign); PREF_GetBoolPref("mail.encrypt_outgoing_mail", &bEncrypt); MSG_CompositionFields *fields = MSG_CreateCompositionFields(real_addr, real_addr, toString, ccString, bccString, "", "", "", "", subject, "", "", "", "", "", bEncrypt, bSign); if (!fields) { return(MAPI_E_FAILURE); } // RICHIE // INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(pOldContext); // int16 win_csid = INTL_GetCSIWinCSID(csi); pDocument = (CGenericDoc*)theApp.m_TextComposeTemplate->OpenDocumentFile(NULL, NULL, /*win_csid RICHIE*/ winShowFlag); if ( !pDocument ) { return(MAPI_E_FAILURE); } CWinCX * pContext = (CWinCX*) pDocument->GetContext(); if ( !pContext ) { return(MAPI_E_FAILURE); } MSG_CompositionPaneCallbacks Callbacks; Callbacks.CreateRecipientsDialog = CreateRecipientsDialog; Callbacks.CreateAskHTMLDialog = CreateAskHTMLDialog; int16 doccsid; MWContext *context = pContext->GetContext(); CComposeFrame *pCompose = (CComposeFrame *) pContext->GetFrame()->GetFrameWnd(); pCompose->SetComposeStuff(context, fields); // squirl away stuff for post-create // This needs to be set TRUE if using the old non-HTML text frame // to prevent dropping dragged URLs pContext->m_bDragging = !pCompose->UseHtml(); if (!pCompose->UseHtml()) { pCompose->SetMsgPane( MSG_CreateCompositionPane(pContext->GetContext(), context, g_MsgPrefs.m_pMsgPrefs, fields, WFE_MSGGetMaster()) ); } ASSERT(pCompose->GetMsgPane()); MSG_SetFEData(pCompose->GetMsgPane(),(void *)pCompose); pCompose->UpdateAttachmentInfo(); // Pass doccsid info to new context for MailToWin conversion doccsid = INTL_GetCSIDocCSID(LO_GetDocumentCharacterSetInfo(context)); INTL_SetCSIDocCSID(LO_GetDocumentCharacterSetInfo(context), (doccsid ? doccsid : INTL_DefaultDocCharSetID(context))); pCompose->DisplayHeaders(NULL); CComposeBar * pBar = pCompose->GetComposeBar(); ASSERT(pBar); LPADDRESSCONTROL pIAddressList = pBar->GetAddressWidgetInterface(); if (!pIAddressList->IsCreated()) { pBar->CreateAddressingBlock(); } // rhp - Deal with addressing the brute force way! This is a // "fix" for bad behavior when creating these windows and not // showing them on the desktop. if (!winShowFlag) // Hack to fix the window not being mapped { pCompose->AppendAddress(MSG_TO_HEADER_MASK, ""); pCompose->AppendAddress(MSG_CC_HEADER_MASK, ""); pCompose->AppendAddress(MSG_BCC_HEADER_MASK, ""); } // Always do plain text composition! pCompose->CompleteComposeInitialization(); // Do this so we don't get popups on "empty" messages if ( (!pInitialText) || (!(*pInitialText)) ) pInitialText = " "; const char * pBody = pInitialText ? pInitialText : MSG_GetCompBody(pCompose->GetMsgPane()); if (pBody) { FE_InsertMessageCompositionText(context,pBody,TRUE); } // // Now set the message as being edited! // pCompose->SetModified(TRUE); // // Finally deal with the attachments... // if (sendMailPtr->MSG_nFileCount > 0) { // Send this puppy when done with the attachments... if (!winShowFlag) { pCompose->SetMAPISendMode(MAPI_SEND); } MSG_AttachmentData *pAttach = (MSG_AttachmentData *) XP_CALLOC((sendMailPtr->MSG_nFileCount + 1), sizeof(MSG_AttachmentData)); if (!pAttach) { return(MAPI_E_INSUFFICIENT_MEMORY); } memset(pAttach, 0, (sendMailPtr->MSG_nFileCount + 1) * sizeof(MSG_AttachmentData)); for (i=0; i<sendMailPtr->MSG_nFileCount; i++) { CString cs; // Create URL from filename... WFE_ConvertFile2Url(cs, (const char *)NSStrSeqGet(mailInfoSeq, stringCount++)); pAttach[i].url = XP_STRDUP(cs); // Now also include the "display" name... StrAllocCopy(pAttach[i].real_name, NSStrSeqGet(mailInfoSeq, stringCount++)); } // Set the list! MSG_SetAttachmentList(pCompose->GetMsgPane(), pAttach); // Now free everything... for (i=0; i<sendMailPtr->MSG_nFileCount; i++) { if (pAttach[i].url) XP_FREE(pAttach[i].url); if (pAttach[i].real_name) XP_FREE(pAttach[i].real_name); } XP_FREE(pAttach); } // // Now, if we were supposed to do the blind send...do it, otherwise, // just popup the window... // if (winShowFlag) { // Post message to compose window to set the initial focus. pCompose->PostMessage(WM_COMP_SET_INITIAL_FOCUS); } else if (sendMailPtr->MSG_nFileCount <= 0) // Send NOW if no attachments! { pCompose->PostMessage(WM_COMMAND, IDM_SEND); } return(SUCCESS_SUCCESS); }
// // This function will create a composition window and just attach // the attachments of interest and pop up the window... // // Return: appropriate MAPI return code... // // extern "C" LONG DoPartialMAPIMailOperation(MAPISendDocumentsType *sendDocPtr) { CGenericDoc *pDocument; // Get a context to use for this call... MWContext *pOldContext = GetUsableContext(); if (!pOldContext) { return(MAPI_E_FAILURE); } // Don't allow a compose window to be created if the user hasn't // specified an email address const char *real_addr = FE_UsersMailAddress(); if (MISC_ValidateReturnAddress(pOldContext, real_addr) < 0) { return(MAPI_E_FAILURE); } // // Now, build the fields object w/o much info... // BOOL bEncrypt = FALSE; BOOL bSign = FALSE; PREF_GetBoolPref("mail.crypto_sign_outgoing_mail", &bSign); PREF_GetBoolPref("mail.encrypt_outgoing_mail", &bEncrypt); MSG_CompositionFields *fields = MSG_CreateCompositionFields(real_addr, real_addr, NULL, "", "", "", "", "", "", "", "", "", "", "", "", bEncrypt, bSign); if (!fields) { return(MAPI_E_FAILURE); } // RICHIE - INTL_CharSetInfo csi = LO_GetDocumentCharacterSetInfo(pOldContext); // int16 win_csid = INTL_GetCSIWinCSID(csi); pDocument = (CGenericDoc*)theApp.m_TextComposeTemplate->OpenDocumentFile(NULL, NULL, /*RICHIE win_csid,*/ TRUE); if ( !pDocument ) { // cleanup fields object MSG_DestroyCompositionFields(fields); return(MAPI_E_FAILURE); } CWinCX * pContext = (CWinCX*) pDocument->GetContext(); if ( !pContext ) { return(MAPI_E_FAILURE); } MSG_CompositionPaneCallbacks Callbacks; Callbacks.CreateRecipientsDialog = CreateRecipientsDialog; Callbacks.CreateAskHTMLDialog = CreateAskHTMLDialog; MWContext *context = pContext->GetContext(); CComposeFrame *pCompose = (CComposeFrame *) pContext->GetFrame()->GetFrameWnd(); pCompose->SetComposeStuff(context,fields); // squirl away stuff for post-create // This needs to be set TRUE if using the old non-HTML text frame // to prevent dropping dragged URLs pContext->m_bDragging = !pCompose->UseHtml(); if (!pCompose->UseHtml()) { pCompose->SetMsgPane(MSG_CreateCompositionPane( pContext->GetContext(), context, g_MsgPrefs.m_pMsgPrefs, fields, WFE_MSGGetMaster())); } ASSERT(pCompose->GetMsgPane()); MSG_SetFEData(pCompose->GetMsgPane(),(void *)pCompose); pCompose->UpdateAttachmentInfo(); // Pass doccsid info to new context for MailToWin conversion /*** doccsid = INTL_GetCSIDocCSID(LO_GetDocumentCharacterSetInfo(pOldContext)); INTL_SetCSIDocCSID(LO_GetDocumentCharacterSetInfo(context), (doccsid ? doccsid : INTL_DefaultDocCharSetID(pOldContext))); ****/ pCompose->DisplayHeaders(NULL); CComposeBar * pBar = pCompose->GetComposeBar(); ASSERT(pBar); LPADDRESSCONTROL pIAddressList = pBar->GetAddressWidgetInterface(); if (!pIAddressList->IsCreated()) { pBar->CreateAddressingBlock(); } // Always do plain text composition! pCompose->CompleteComposeInitialization(); // // Finally deal with the attachments... // NSstringSeq mailInfoSeq = (NSstringSeq) &(sendDocPtr->dataBuf[0]); DWORD stringCount = 0; DWORD i; TRACE("MAPI: ProcessMAPISendDocuments() # of Attachments = [%d]\n", sendDocPtr->nFileCount); if (sendDocPtr->nFileCount > 0) { MSG_AttachmentData *pAttach = (MSG_AttachmentData *) XP_CALLOC((sendDocPtr->nFileCount + 1), sizeof(MSG_AttachmentData)); if (!pAttach) { return(MAPI_E_INSUFFICIENT_MEMORY); } memset(pAttach, 0, (sendDocPtr->nFileCount + 1) * sizeof(MSG_AttachmentData)); for (i=0; i<sendDocPtr->nFileCount; i++) { CString cs; // Create URL from filename... WFE_ConvertFile2Url(cs, (const char *)NSStrSeqGet(mailInfoSeq, stringCount++)); pAttach[i].url = XP_STRDUP(cs); // Now also include the "display" name... StrAllocCopy(pAttach[i].real_name, NSStrSeqGet(mailInfoSeq, stringCount++)); } // Set the list! MSG_SetAttachmentList(pCompose->GetMsgPane(), pAttach); // Now free everything... for (i=0; i<sendDocPtr->nFileCount; i++) { if (pAttach[i].url) XP_FREE(pAttach[i].url); if (pAttach[i].real_name) XP_FREE(pAttach[i].real_name); } XP_FREE(pAttach); } // // Now some checking for ... well I'm not sure... // if (MSG_GetAttachmentList(pCompose->GetMsgPane())) pCompose->SetModified(TRUE); else pCompose->SetModified(FALSE); // Post message to compose window to set the initial focus. pCompose->PostMessage(WM_COMP_SET_INITIAL_FOCUS); // // Now, just popup the window... // pCompose->ShowWindow(TRUE); // return pCompose->GetMsgPane(); rhp - used to return the MsgPane return(SUCCESS_SUCCESS); }