//--------------------------------------------------------------------------- //normal call using Keys property HWND __fastcall TPushKeys::Push() { return PushMethod(fKeys); }
int SaveMessage( struct ClassData * data, STRPTR Message, ULONG msgnum ) { struct YGRDBIndex * idx; int rc = ERR_NOMEM, x=0; UBYTE *msg=Message, file[1024]; BPTR fd; DBG("Saving message...\n"); DBG_ASSERT(Message && *Message); if(!(Message && *Message)) return ERR_INTERNAL; ObtainSemaphore(data->sem); if(!(idx = malloc(sizeof(struct YGRDBIndex)))) goto done; // bzero( idx, sizeof(struct YGRDBIndex)); DBG_ASSERT((strlen(Message) > 5) && !strncmp( Message, "From ", 5 )); #define cpln( src, dst ) \ memcpy(dst,src, MIN(FindPos(src,"\n"),(int)sizeof(dst)-1)) while(*msg && (x < 3)) { if(!Strnicmp( msg, "From:", 5)) {x++; cpln(&msg[6], idx->from);} else if(!Strnicmp( msg, "Subject:", 8)) {x++; cpln(&msg[9], idx->subj);} else if(!Strnicmp( msg, "Date:", 5)) {x++; cpln(&msg[6], idx->date);} msg++; } idx->msgnum = msgnum; idx->udata = data->subtask.folder; DBG_VALUE(msgnum); DBG_STRING(idx->from); DBG_STRING(idx->subj); DBG_STRING(idx->date); idx->next = data->subtask.folder->idx; data->subtask.folder->idx = idx; data->subtask.folder->Total++; data->subtask.folder->New++; if(SameGroupFolder( data, FALSE )) { PushMethod( data->appobj, data->rightlist, 3, MUIM_NList_InsertSingle, idx, MUIV_NList_Insert_Sorted); } rc = MakeMailFile( data->subtask.folder, file, sizeof(file)-1, msgnum, (data->subtask.folder->New == 1)); if(rc != ERR_NOERROR) goto done; if((fd = Open( file, MODE_NEWFILE))) { Write( fd, Message, strlen(Message)); #ifdef DEBUG Flush( fd ); #endif Close( fd ); } DBG_STRING(file); if((rc = IoErr()) == 0) rc = ERR_NOERROR; done: ReleaseSemaphore(data->sem); return(rc); }
//--------------------------------------------------------------------------- //pass string in function call HWND __fastcall TPushKeys::Push(CString k) { return PushMethod(k); }