void rx_mailforward(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; struct results *results = params->results; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); params->results = AllocVecPooled(G->SharedMemPool, sizeof(*results)); } break; case RXIF_ACTION: { static int winNumber = -1; struct WriteMailData *wmData; results->window = &winNumber; // check if there is already an open, quiet write window // which is linked as the current active rexx window and // if so we close it or otherwise the window will be "lost" if(G->ActiveRexxWMData != NULL && G->ActiveRexxWMData->quietMode == TRUE) { CleanupWriteMailData(G->ActiveRexxWMData); } if((wmData = NewMessage(NMM_FORWARD, args->quiet ? NEWF_QUIET : 0L)) != NULL) { G->ActiveRexxWMData = wmData; if(wmData->window != NULL) winNumber = xget(wmData->window, MUIA_WriteWindow_Num); if(args->quiet == FALSE && wmData->window != NULL) set(wmData->window, MUIA_Window_Activate, TRUE); } else params->rc = RETURN_ERROR; } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); if(results != NULL) FreeVecPooled(G->SharedMemPool, results); } break; } LEAVE(); }
void NewFreeArgs(struct NewRDArgs *rdargs) { ENTER(); D(DBF_STARTUP, "FreeArgs(rdargs->FreeArgs)"); FreeArgs(rdargs->FreeArgs); if(rdargs->RDArgs != NULL) { free((void *)rdargs->RDArgs->RDA_Source.CS_Buffer); D(DBF_STARTUP, "FreeDosObject(DOS_RDARGS, rdargs->RDArgs)"); FreeDosObject(DOS_RDARGS, rdargs->RDArgs); } if(rdargs->Args != NULL) { ULONG i; for(i=0; i < rdargs->MaxArgs; i++) { if(rdargs->Args[i] != NULL) FreeVecPooled(rdargs->Pool, rdargs->Args[i]); } FreeVecPooled(rdargs->Pool, rdargs->Args); rdargs->Args = NULL; } if(rdargs->ToolWindow != NULL) { FreeVecPooled(rdargs->Pool, rdargs->ToolWindow); rdargs->ToolWindow = NULL; } if(rdargs->WinFH != 0) { D(DBF_STARTUP, "SelectOutput( .. ) .. Close( ... )"); SelectOutput(rdargs->OldOutput); SelectInput(rdargs->OldInput); Close(rdargs->WinFH); rdargs->WinFH = 0; } if(rdargs->Pool != NULL) { #if defined(__amigaos4__) FreeSysObject(ASOT_MEMPOOL, rdargs->Pool); #else DeletePool(rdargs->Pool); #endif rdargs->Pool = NULL; } D(DBF_STARTUP, "memory freed"); LEAVE(); }
void rx_show(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); } break; case RXIF_ACTION: { // lets signal the application to uniconify and open the windows PopUp(); } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); } break; } LEAVE(); }
void rx_restart(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); } break; case RXIF_ACTION: { DoMethod(G->App, MUIM_Application_ReturnID, args->force ? ID_RESTART_FORCE : ID_RESTART); } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); } break; } LEAVE(); }
void rx_setfolder(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); } break; case RXIF_ACTION: { struct Folder *folder; if((folder = FO_GetFolderRexx(args->folder, NULL))) MA_ChangeFolder(folder, TRUE); else params->rc = RETURN_ERROR; } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); } break; } LEAVE(); }
void rx_setflag(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); } break; case RXIF_ACTION: { int value; struct Mail *mail; if((mail = MA_GetActiveMail(NULL, NULL, NULL))) { if(args->vol) { if((value = *args->vol) >= 0 && value < 8) setVOLValue(mail, value); else params->rc = RETURN_ERROR; } if(args->per) { if((value = *args->per) >= 0 && value < 8) { if((unsigned int)value != getPERValue(mail)) { setPERValue(mail, value); MA_UpdateMailFile(mail); } } else params->rc = RETURN_ERROR; } } else params->rc = RETURN_WARN; } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); } break; } LEAVE(); }
ft_free( FT_Memory memory, void* block ) { // FT_UNUSED( memory ); // free( block ); FreeVecPooled( memory->user, block ); }
ft_free( FT_Memory memory, void* block ) { #ifdef __amigaos4__ FreeVecPooled( memory->user, block ); #else Free_VecPooled( memory->user, block ); #endif }
void rx_addrdelete(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); } break; case RXIF_ACTION: { // if the command was called without any parameter it will delete the active entry // if not we search for the one in question and if found delete it. if(args->alias != NULL) { if(SearchABook(&G->abook, args->alias, ASM_ALIAS|ASM_USER|ASM_LIST|ASM_GROUP, &G->abook.arexxABN) != 0) { if(G->ABookWinObject != NULL) set(G->ABookWinObject, MUIA_AddressBookWindow_ActiveEntry, G->abook.arexxABN); } } if(G->abook.arexxABN != NULL) { RemoveABookNode(G->abook.arexxABN); DeleteABookNode(G->abook.arexxABN); G->abook.arexxABN = NULL; G->abook.modified = TRUE; // update an existing address book window as well if(G->ABookWinObject != NULL) DoMethod(G->ABookWinObject, MUIM_AddressBookWindow_RebuildTree); } else params->rc = RETURN_WARN; } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); } break; } LEAVE(); }
void rx_geturl(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); } break; case RXIF_ACTION: { struct BusyNode *busy; busy = BusyBegin(BUSY_TEXT); BusyText(busy, tr(MSG_TR_Downloading), ""); if(DoAction(NULL, TA_DownloadURL, TT_DownloadURL_Server, args->url, TT_DownloadURL_Filename, args->filename, TT_DownloadURL_Flags, DLURLF_SIGNAL, TAG_DONE) != NULL) { MiniMainLoop(); } else { params->rc = RETURN_ERROR; } BusyEnd(busy); } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); } break; } LEAVE(); }
ft_realloc( FT_Memory memory, long cur_size, long new_size, void* block ) { // FT_UNUSED( memory ); // FT_UNUSED( cur_size ); // return realloc( block, new_size ); void* new_block; new_block = AllocVecPooled ( memory->user, new_size ); if ( new_block != NULL ) { CopyMem ( block, new_block, ( new_size > cur_size ) ? cur_size : new_size ); FreeVecPooled ( memory->user, block ); } return new_block; }
void rx_writereplyto(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); } break; case RXIF_ACTION: { if(G->ActiveRexxWMData != NULL && G->ActiveRexxWMData->window != NULL) { char *addresses[2]; // we have to supply a NULL terminated array of addresses addresses[0] = args->address; addresses[1] = NULL; DoMethod(G->ActiveRexxWMData->window, MUIM_WriteWindow_InsertAddresses, MUIV_WriteWindow_RcptType_ReplyTo, addresses, FALSE); } else params->rc = RETURN_ERROR; } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); } break; } LEAVE(); }
void HandleIntuiActions(struct IIHData *iihdata, struct IntuitionBase *IntuitionBase) { struct IntuiActionMsg *am; D(bug("Handle Intuition action messages\n")); if (iihdata->ActiveSysGadget) { D(bug("Handle Intuition action messages. Doing nothing because of active drag or resize gadget!\n")); return; } for (;;) { LOCK_ACTIONS(); am = (struct IntuiActionMsg *)RemHead((struct List *)&iihdata->IntuiActionQueue); UNLOCK_ACTIONS(); if (!am) break; am->handler(am, IntuitionBase); if (am->task) { Forbid(); am->done = TRUE; Signal(am->task, SIGF_INTUITION); Permit(); } else { FreeVecPooled(iihdata->ActionsMemPool,am); } } D(bug("Intuition action messages handled\n")); }
ft_realloc( FT_Memory memory, long cur_size, long new_size, void* block ) { void* new_block; #ifdef __amigaos4__ new_block = AllocVecPooled ( memory->user, new_size ); #else new_block = Alloc_VecPooled ( memory->user, new_size ); #endif if ( new_block != NULL ) { CopyMem ( block, new_block, ( new_size > cur_size ) ? cur_size : new_size ); #ifdef __amigaos4__ FreeVecPooled ( memory->user, block ); #else Free_VecPooled ( memory->user, block ); #endif } return new_block; }
void rx_addredit(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); } break; case RXIF_ACTION: { struct ABookNode *abn; abn = G->abook.arexxABN; if(abn == NULL && G->ABookWinObject != NULL) abn = (struct ABookNode *)xget(G->ABookWinObject, MUIA_AddressBookWindow_ActiveEntry); SHOWVALUE(DBF_ABOOK, abn); if(abn != NULL) { if(args->alias != NULL) strlcpy(abn->Alias, args->alias, sizeof(abn->Alias)); if(args->name != NULL) strlcpy(abn->RealName, args->name, sizeof(abn->RealName)); if(args->email != NULL) strlcpy(abn->Address, args->email, sizeof(abn->Address)); if(args->pgp != NULL) strlcpy(abn->PGPId, args->pgp, sizeof(abn->PGPId)); if(args->homepage != NULL) strlcpy(abn->Homepage, args->homepage, sizeof(abn->Homepage)); if(args->street != NULL) strlcpy(abn->Street, args->street, sizeof(abn->Street)); if(args->city != NULL) strlcpy(abn->City, args->city, sizeof(abn->City)); if(args->country != NULL) strlcpy(abn->Country, args->country, sizeof(abn->Country)); if(args->phone != NULL) strlcpy(abn->Phone, args->phone, sizeof(abn->Phone)); if(args->comment != NULL) strlcpy(abn->Comment, args->comment, sizeof(abn->Comment)); if(args->birthdate != NULL) { char dateStr[SIZE_SMALL]; // if the user supplied 0 as the birthdate, he wants to "delete" the current // birthdate if(*args->birthdate == 0) abn->Birthday = 0; else if(BirthdayToString(*args->birthdate, dateStr, sizeof(dateStr)) == TRUE) abn->Birthday = *args->birthdate; else { params->rc = RETURN_ERROR; break; } } if(args->image != NULL) strlcpy(abn->Photo, args->image, sizeof(abn->Photo)); if(args->member != NULL && abn->type == ABNT_LIST) { char **p; // free the list members in case we are told to replace them if(args->add == FALSE) { dstrfree(abn->ListMembers); abn->ListMembers = NULL; } for(p = args->member; *p != NULL; p++) { dstrcat(&abn->ListMembers, *p); dstrcat(&abn->ListMembers, "\n"); } } G->abook.arexxABN = abn; G->abook.modified = TRUE; // update an existing address book window as well if(G->ABookWinObject != NULL) DoMethod(G->ABookWinObject, MUIM_AddressBookWindow_RedrawActiveEntry); } else params->rc = RETURN_ERROR; } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); } break; } LEAVE(); }
void rx_mailstatus(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); } break; case RXIF_ACTION: { switch(toupper(args->status[0])) { case 'N': // new { MA_SetStatusTo(SFLAG_NEW, SFLAG_READ, FALSE); } break; case 'O': // old case 'R': // read { MA_SetStatusTo(SFLAG_READ, SFLAG_NEW, FALSE); } break; case 'U': // unread { MA_SetStatusTo(SFLAG_NONE, SFLAG_NEW|SFLAG_READ, FALSE); } break; case 'H': // hold { // hold state no longer exists, keep for compatibility reasons } break; case 'Q': // queued case 'W': // wait to be sent { // queued state no longer exists, keep for compatibility reasons } break; default: { params->rc = RETURN_WARN; } break; } } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); } break; } LEAVE(); }
/*********************************************************************** Import the given 0 terminated text by invoking the given import Hook for every line ***********************************************************************/ BOOL ImportText(struct InstData *data, const char *contents, struct Hook *importHook, LONG wraplength, struct MinList *lines) { struct line_node *line; ENTER(); // make sure we start with an empty list of lines InitLines(lines); if((line = AllocVecPooled(data->mypool, sizeof(struct line_node))) != NULL) { struct ImportMessage im; memset(line, 0, sizeof(*line)); im.Data = contents; im.ImportWrap = wraplength; im.PoolHandle = data->mypool; im.ConvertTabs = data->ConvertTabs; im.TabSize = data->TabSize; while(TRUE) { struct line_node *new_line; im.linenode = &line->line; // invoke the hook, it will return NULL in case it is finished or // an error occured im.Data = (char*)CallHookPkt(importHook, NULL, &im); if(im.Data == NULL) { if(line->line.Contents != NULL) { // add the last imported line to the list AddLine(lines, line); } else { // free the line node if it didn't contain any contents if(ContainsLines(lines) == FALSE) { FreeVecPooled(data->mypool, line); } else { // if the line has nor predecessor it was obviously the first line // so we prepare a "fake" line_node to let the textEditor clear our // text if(Init_LineNode(data, line, "\n") == TRUE) AddLine(lines, line); else FreeVecPooled(data->mypool, line); } } // bail out break; } // add the imported line to the list AddLine(lines, line); if((new_line = AllocVecPooled(data->mypool, sizeof(struct line_node))) == NULL) break; // inherit the flow from the current line for the next line, // but only if the clearFlow variable is not set if(line->line.clearFlow == FALSE) new_line->line.Flow = line->line.Flow; line = new_line; } } RETURN(ContainsLines(lines)); return ContainsLines(lines); }
void rx_mailinfo(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; struct results *results = params->results; struct optional *optional = params->optional; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); params->results = AllocVecPooled(G->SharedMemPool, sizeof(*results)); params->optional = AllocVecPooled(G->SharedMemPool, sizeof(*optional)); if(params->optional == NULL) params->rc = RETURN_ERROR; } break; case RXIF_ACTION: { struct Mail *mail = NULL; struct Folder *folder = NULL; if(args->index != NULL) { Object *lv = (Object *)xget(G->MA->GUI.PG_MAILLIST, MUIA_MainMailListGroup_MainList); optional->active = args->index[0]; DoMethod(lv, MUIM_NList_GetEntry, optional->active, &mail); if(mail != NULL) folder = mail->Folder; } else mail = MA_GetActiveMail(NULL, &folder, (APTR)&optional->active); if(mail != NULL) { struct ExtendedMail *email; if((email = MA_ExamineMail(folder, mail->MailFile, TRUE)) != NULL) { int pf = getPERValue(mail); int vf = getVOLValue(mail); int i; GetMailFile(optional->filename, sizeof(optional->filename), NULL, mail); results->filename = optional->filename; results->index = &optional->active; if(hasStatusError(mail)) results->status = "E"; // Error status else if(mail->Folder != NULL && isOutgoingFolder(mail->Folder)) results->status = "W"; // Queued (WaitForSend) status else if(mail->Folder != NULL && isDraftsFolder(mail->Folder)) results->status = "H"; // Hold status else if(hasStatusSent(mail)) results->status = "S"; // Sent status else if(hasStatusReplied(mail)) results->status = "R"; // Replied status else if(hasStatusForwarded(mail)) results->status = "F"; // Forwarded status else if(!hasStatusRead(mail)) { if(hasStatusNew(mail)) results->status = "N"; // New status else results->status = "U"; // Unread status } else if(!hasStatusNew(mail)) results->status = "O"; // Old status if((results->fromall = calloc(email->NumSFrom+2, sizeof(char *))) != NULL) { if((results->fromall[0] = strdup(BuildAddress(optional->address, sizeof(optional->address), mail->From.Address, mail->From.RealName))) == NULL) params->rc = RETURN_ERROR; for(i = 0; i < email->NumSFrom; i++) { if((results->fromall[i+1] = strdup(BuildAddress(optional->address, sizeof(optional->address), email->SFrom[i].Address, email->SFrom[i].RealName))) == NULL) params->rc = RETURN_ERROR; } results->from = results->fromall[0]; } else params->rc = RETURN_ERROR; if((results->toall = calloc(email->NumSTo+2, sizeof(char *))) != NULL) { if((results->toall[0] = strdup(BuildAddress(optional->address, sizeof(optional->address), mail->To.Address, mail->To.RealName))) == NULL) params->rc = RETURN_ERROR; for(i = 0; i < email->NumSTo; i++) { if((results->toall[i+1] = strdup(BuildAddress(optional->address, sizeof(optional->address), email->STo[i].Address, email->STo[i].RealName))) == NULL) params->rc = RETURN_ERROR; } results->to = results->toall[0]; } else params->rc = RETURN_ERROR; if((results->replytoall = calloc(email->NumSReplyTo+2, sizeof(char *))) != NULL) { if((results->replytoall[0] = strdup(BuildAddress(optional->address, sizeof(optional->address), mail->ReplyTo.Address[0] != '\0' ? mail->ReplyTo.Address : mail->From.Address, mail->ReplyTo.Address[0] != '\0' ? mail->ReplyTo.RealName : mail->From.RealName))) == NULL) params->rc = RETURN_ERROR; for(i = 0; i < email->NumSReplyTo; i++) { if((results->replytoall[i+1] = strdup(BuildAddress(optional->address, sizeof(optional->address), email->SReplyTo[i].Address, email->SReplyTo[i].RealName))) == NULL) params->rc = RETURN_ERROR; } results->replyto = results->replytoall[0]; } else params->rc = RETURN_ERROR; if((results->ccall = calloc(email->NumCC+1, sizeof(char *))) != NULL) { for(i = 0; i < email->NumCC; i++) { if((results->ccall[i] = strdup(BuildAddress(optional->address, sizeof(optional->address), email->CC[i].Address, email->CC[i].RealName))) == NULL) params->rc = RETURN_ERROR; } results->cc = results->ccall[0]; } else params->rc = RETURN_ERROR; if((results->bccall = calloc(email->NumBCC+1, sizeof(char *))) != NULL) { for(i = 0; i < email->NumBCC; i++) { if((results->bccall[i] = strdup(BuildAddress(optional->address, sizeof(optional->address), email->BCC[i].Address, email->BCC[i].RealName))) == NULL) params->rc = RETURN_ERROR; } results->bcc = results->bccall[0]; } else params->rc = RETURN_ERROR; if((results->resenttoall = calloc(email->NumResentTo+1, sizeof(char *))) != NULL) { for(i = 0; i < email->NumResentTo; i++) { if((results->resenttoall[i] = strdup(BuildAddress(optional->address, sizeof(optional->address), email->ResentTo[i].Address, email->ResentTo[i].RealName))) == NULL) params->rc = RETURN_ERROR; } results->resentto = results->resenttoall[0]; } else params->rc = RETURN_ERROR; optional->size = mail->Size; DateStamp2String(optional->date, sizeof(optional->date), &mail->Date, DSS_USDATETIME, TZC_UTC2LOCAL); results->date = optional->date; results->subject = strdup(mail->Subject); results->size = &optional->size; results->msgid = email->messageID != NULL ? strdup(email->messageID) : NULL; snprintf(optional->flags, sizeof(optional->flags), "%c%c%c%c%c-%c%c%c", isMultiRCPTMail(mail) ? 'M' : '-', isMP_MixedMail(mail) ? 'A' : '-', isMP_ReportMail(mail) ? 'R' : '-', isMP_CryptedMail(mail)? 'C' : '-', isMP_SignedMail(mail) ? 'S' : '-', pf ? pf+'0' : '-', vf ? vf+'0' : '-', hasStatusMarked(mail) ? 'M' : '-' ); results->flags = optional->flags; MA_FreeEMailStruct(email); } else params->rc = RETURN_ERROR; } else params->rc = RETURN_ERROR; } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); if(results != NULL) { FreeStrArray(results->fromall); FreeStrArray(results->toall); FreeStrArray(results->replytoall); FreeStrArray(results->ccall); FreeStrArray(results->bccall); FreeStrArray(results->resenttoall); free(results->subject); free(results->msgid); FreeVecPooled(G->SharedMemPool, results); } if(optional != NULL) FreeVecPooled(G->SharedMemPool, optional); } break; } LEAVE(); }
void rx_setmail(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); } break; case RXIF_ACTION: { Object *lv = (Object *)xget(G->MA->GUI.PG_MAILLIST, MUIA_MainMailListGroup_MainList); int num = -1; int max = xget(lv, MUIA_NList_Entries); if(args->msgid != NULL) { struct Mail *mail; // find the mail with the given message id first if((mail = FindMailByMsgID(GetCurrentFolder(), args->msgid)) != NULL) { int idx = 0; struct Mail *nlistMail; // now find the mail in the GUI do { DoMethod(G->MA->GUI.PG_MAILLIST, MUIM_NList_GetEntry, idx, &nlistMail); if(nlistMail == mail) { num = idx; break; } else idx++; } while(nlistMail != NULL); } } else { num = *args->num; } if(num >= 0 && num < max) DoMethod(lv, MUIM_NList_SetActive, num, MUIV_NList_SetActive_Jump_Center); else params->rc = RETURN_ERROR; } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); } break; } LEAVE(); }
void rx_addrnew(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg) { struct args *args = params->args; struct results *results = params->results; struct optional *optional = params->optional; ENTER(); switch(action) { case RXIF_INIT: { params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args)); params->results = AllocVecPooled(G->SharedMemPool, sizeof(*results)); params->optional = AllocVecPooled(G->SharedMemPool, sizeof(*optional)); if(params->optional == NULL) params->rc = RETURN_ERROR; } break; case RXIF_ACTION: { enum ABookNodeType type; if(args->type != NULL) { if(tolower(*args->type) == 'g') type = ABNT_GROUP; else if(tolower(*args->type) == 'l') type = ABNT_LIST; else type = ABNT_USER; } else type = ABNT_USER; InitABookNode(&optional->abn, type); if(args->alias != NULL) strlcpy(optional->abn.Alias, args->alias, sizeof(optional->abn.Alias)); if(args->name != NULL) strlcpy(optional->abn.RealName, args->name, sizeof(optional->abn.RealName)); if(args->email != NULL) strlcpy(optional->abn.Address, args->email, sizeof(optional->abn.Address)); if(IsStrEmpty(optional->abn.Alias) == TRUE) { if(optional->abn.type == ABNT_USER) SetDefaultAlias(&optional->abn); else params->rc = RETURN_ERROR; } if(params->rc == 0) { struct ABookNode *abn; FixAlias(&G->abook, &optional->abn, NULL); results->alias = optional->abn.Alias; if((abn = CreateABookNode(optional->abn.type)) != NULL) { struct ABookNode *group; struct ABookNode *afterThis; memcpy(abn, &optional->abn, sizeof(*abn)); if(G->ABookWinObject != NULL) { group = (struct ABookNode *)xget(G->ABookWinObject, MUIA_AddressBookWindow_ActiveGroup); afterThis = (struct ABookNode *)xget(G->ABookWinObject, MUIA_AddressBookWindow_ActiveEntry); } else { group = &G->abook.rootGroup; afterThis = NULL; } AddABookNode(group, abn, afterThis); G->abook.arexxABN = abn; G->abook.modified = TRUE; // update an existing address book window as well if(G->ABookWinObject != NULL) DoMethod(G->ABookWinObject, MUIM_AddressBookWindow_RebuildTree); set(G->ABookWinObject, MUIA_AddressBookWindow_Modified, TRUE); AppendToLogfile(LF_VERBOSE, 71, tr(MSG_LOG_NewAddress), optional->abn.Alias); } else params->rc = RETURN_ERROR; } } break; case RXIF_FREE: { if(args != NULL) FreeVecPooled(G->SharedMemPool, args); if(results != NULL) FreeVecPooled(G->SharedMemPool, results); if(optional != NULL) FreeVecPooled(G->SharedMemPool, optional); } break; } LEAVE(); }