|
// *********************************************************
// メールデータ受信
// 戻り値 : true 成功, false 失敗
// *********************************************************
BOOL LboxBasp::RcvData( LboxListview *Lview )
{
if ( this->User.operator == ( "" ) ) {
return false;
}
return LboxBasp::RcvData(
this->User.szLboxString,
this->Password.szLboxString,
Lview
);
}
BOOL LboxBasp::RcvData(
LboxString *LUser, LboxString *LPass, LboxListview *Lview )
{
return LboxBasp::RcvData(
LUser->szLboxString,
LPass->szLboxString,
Lview
);
}
BOOL LboxBasp::RcvData(
LPTSTR lpUser, LPTSTR lpPass, LboxListview *Lview )
{
this->ErrorDescription.SetChar(0,0);
if ( this->lib == NULL ) {
this->ErrorDescription.operator = (
"Bsmtp.dll がインストールされていません"
);
return false;
}
LPFUNC_BPOP3 DllBPOP3;
LPFUNC_BMIME DllBMIME;
LPFUNC_BFreeArray DllBFreeArray;
DllBPOP3 =
(LPFUNC_BPOP3)GetProcAddress( lib, "BPOP3" );
if ( DllBPOP3 == NULL ) {
return false;
}
DllBMIME =
(LPFUNC_BMIME)GetProcAddress( lib, "BMIME" );
if ( DllBMIME == NULL ) {
return false;
}
DllBFreeArray =
(LPFUNC_BFreeArray)GetProcAddress( lib, "BFreeArray" );
if ( DllBFreeArray == NULL ) {
return false;
}
int nRet;
RetArray ra,raRow;
LboxString LString;
LString.operator = (">");
LString.operator += (this->RcvDir.szLboxString);
this->ErrorDescription.SetChar( 0, 0 );
nRet = DllBPOP3(
this->POP3Server.szLboxString,
lpUser,
lpPass,
"SAVEALL",
LString.szLboxString,
&ra,
this->ErrorDescription.szLboxString
);
if ( nRet <= 0 ) {
return false;
}
Lview->Initialize();
Lview->AddColumn( LVCFMT_LEFT, 100, "" );
Lview->AddColumn( LVCFMT_LEFT, 100, "送信者" );
Lview->AddColumn( LVCFMT_LEFT, 100, "件名" );
Lview->AddColumn( LVCFMT_LEFT, 100, "受信日時" );
Lview->AddColumn( LVCFMT_LEFT, 100, "ファイル" );
int i,j;
for( i = 0; i < ra.counter; i++ ) {
nRet = DllBMIME(
"GETNOF",
ra.array[i],
this->RcvDir.szLboxString,
&raRow,
this->ErrorDescription.szLboxString
);
if ( nRet <= 0 ) {
continue;
}
Lview->AddRow();
Lview->SetColumnPrintf( 0, "%d", i+1 );
Lview->SetColumnText( 4, ra.array[i] );
for( j = 0; j < raRow.counter; j++ ) {
LString.operator = (raRow.array[j]);
LString.SetChar( 5, 0 );
if ( LString.operator == ("From:") ) {
LString.operator = (raRow.array[j]);
LString.Replace( "From: ", "" );
Lview->SetColumnText( 1, &LString );
}
}
for( j = 0; j < raRow.counter; j++ ) {
LString.operator = (raRow.array[j]);
LString.SetChar( 8, 0 );
if ( LString.operator == ("Subject:") ) {
LString.operator = (raRow.array[j]);
LString.Replace( "Subject: ", "" );
Lview->SetColumnText( 2, &LString );
}
}
for( j = 0; j < raRow.counter; j++ ) {
LString.operator = (raRow.array[j]);
LString.SetChar( 5, 0 );
if ( LString.operator == ("Date:") ) {
LString.operator = (raRow.array[j]);
LString.Replace( "Date: ", "" );
Lview->SetColumnText( 3, &LString );
}
}
}
DllBFreeArray(&raRow);
DllBFreeArray(&ra);
Lview->Fit();
return true;
}
| |