rem: if (!authenticate(client)) return FALSE;
add: if(passwd.isEmpty() || mLogin.isEmpty()) { KMPasswdDialog *d = new KMPasswdDialog(NULL,NULL,this, "Please set Password and Username", mLogin, decryptStr(passwd)); if(!d->exec()) return FALSE; else { mPasswd = encryptStr(mPasswd); passwd = decryptStr(mPasswd); passwd = decryptStr(passwd); } }     if (client.Open(mHost,mPort) != '+') return popError("OPEN", client);    while((replyCode = client.User(mLogin)) != '+') { if(replyCode == '-') { KMPasswdDialog *d = new KMPasswdDialog(NULL,NULL,this, "Incorrect Username", mLogin, decryptStr(passwd)); if(!d->exec()) return FALSE; else { mPasswd = encryptStr(mPasswd); passwd = decryptStr(mPasswd); passwd = decryptStr(passwd); } } else return popError("USER", client); }  while((replyCode =client.Pass(decryptStr(passwd))) != '+') { if(replyCode == '-') { KMPasswdDialog *d = new KMPasswdDialog(NULL,NULL,this, "Incorrect Password", mLogin, decryptStr(passwd)); if(!d->exec()) return FALSE; else { mPasswd = encryptStr(mPasswd); passwd = decryptStr(mPasswd); passwd = decryptStr(passwd); } } else return popError("PASS", client); }
context: bool KMAcctPop::doProcessNewMail(bool interactive){  DwPopClient client;  QString passwd;  QString response, status;  int num, size;	// number of all msgs / size of all msgs  int id, i;		// id of message to read  int tmout;  int dummy;  char dummyStr[32];  // int replyCode; // ReplyCode need from User & Passwd call.  KMMessage* msg;  gotMsgs = FALSE;  bool doFetchMsg;  bool addedOk;   //Flag if msg was delivered succesfully  // is everything specified ?  app->processEvents();  if (mHost.isEmpty() || mPort==0)  {    warning(i18n("Please specify Host, Port  and\n"		 "destination folder in the settings\n"		 "and try again."));    return FALSE;  }  client.SetReceiveTimeout(20);  // Handle connect, user, and password.  if (!authenticate(client)) return FALSE;  if (client.Stat() != '+') return popError("STAT", client);  response = client.SingleLineResponse().c_str();  sscanf(response.data(), "%3s %d %d", dummyStr, &num, &size);//#warning "*** If client.Last() cannot be found then install the latest kdesupport"  if (client.Last() == '+' && !mRetrieveAll)  {    response = client.SingleLineResponse().c_str();    sscanf(response.data(), "%3s %d", dummyStr, &id);    id++;  }  else id = 1;  // workaround but still is no good. If msgs are too big in size  // we will get a timeout.  client.SetReceiveTimeout(40);  addedOk = true;   // do while there are mesages to take and last msg wass added succesfully  while (id <= num && addedOk)  {    client.SetReceiveTimeout(40);    if (KMBroadcastStatus::instance()->abortRequested()) {      client.Quit();      return gotMsgs;    }    KMBroadcastStatus::instance()->setStatusMsg( i18n("Message ") +			                QString("%1/%2").arg(id).arg(num) );    KMBroadcastStatus::instance()->setStatusProgressPercent( (id*100) / num );    app->processEvents();    if (client.List(id) != '+')      return popError("LIST", client);    response = client.SingleLineResponse().c_str();    sscanf(response.data(), "%3s %d %d", dummyStr, &dummy, &size);    doFetchMsg = TRUE;    if (size > 4500 && !mRetrieveAll)    {      // If the message is large it is cheaper to first load      // the header to check the status of the message.      // We will have to load the entire message with the RETR      // command below, so we will not fetch the header for      // small messages.      if (client.Top(id,1) != '+')	return popError("TOP", client);      response = client.MultiLineResponse().c_str();      i = response.find("\nStatus:");      if (i<0) i = response.find("\rStatus:");      if (i>=0)      {	status = response.mid(i+8,32).stripWhiteSpace();	if (strnicmp(status,"RO",2)==0 ||	    strnicmp(status,"OR",2)==0)	{	  doFetchMsg=FALSE;	  debug("message %d is old -- no need to download it", id);	}      }    }    if (doFetchMsg)    {      // set timeout depending on size      tmout = size >> 8;      if (tmout < 30) tmout = 30;      client.SetReceiveTimeout(tmout);      if (client.Retr(id) != '+')      return popError("RETR", client);      response = client.MultiLineResponse().c_str();      msg = new KMMessage;      msg->fromString(response,TRUE);      if (mRetrieveAll || msg->status()!=KMMsgStatusOld)      addedOk = processNewMsg(msg); //added ok? Error displayed if not.      else delete msg;    }    // If we should delete from server _and_ we added ok then delete it    if(!mLeaveOnServer && addedOk)    {      if(client.Dele(id) != '+')	return popError("DELE",client);      else 	cout << client.SingleLineResponse().c_str();    }    gotMsgs = TRUE;    id++;  }  client.Quit();  return gotMsgs;}