예제 #1
0
void PasswordReminder::onButtonClicked( wxCommandEvent& event )
{
	if (event.GetId() == m_butSend->GetId())
	{
		if (!isEmailValid())
		{
			gcMessageBox(this, Managers::GetString(L"#PR_VALIDEMAIL"), Managers::GetString(L"#PR_ERRTITLE"));
			return;
		}

		m_butSend->Enable(false);
		m_tbEmail->Enable(false);

		wxString str = m_tbEmail->GetValue();
		gcString email((const wchar_t*)str.c_str());

		m_pThread = new PassReminderThread(email.c_str());
		m_pThread->onCompleteEvent += guiDelegate(this, &PasswordReminder::onComplete);
		m_pThread->onErrorEvent += guiDelegate(this, &PasswordReminder::onError);
		m_pThread->start();
	}
	else
	{
		Close();
	}
}
예제 #2
0
파일: person.cpp 프로젝트: KDE/syndication
QString Person::debugInfo() const
{
    QString info;
    info += QLatin1String("# Person begin ####################\n");

    QString dname = name();

    if (!dname.isNull()) {
        info += QLatin1String("name: #") + dname + QLatin1String("#\n");
    }

    QString duri = uri();

    if (!duri.isNull()) {
        info += QLatin1String("uri: #") + duri + QLatin1String("#\n");
    }

    QString demail = email();

    if (!demail.isNull()) {
        info += QLatin1String("email: #") + demail + QLatin1String("#\n");
    }

    info += QLatin1String("# Person end ######################\n");

    return info;
}
예제 #3
0
int CharCreationManager::IsReserved(const char* name, AccountID acctID)
{
    // Check to see if this name is reserved.  Does this check by comparing
    // the email address of the account with that stored in the migration table.
    csString query;
    csString escape;
    db->Escape(escape, name);
    query.Format("SELECT m.email FROM migration m WHERE m.username='******'", escape.GetData());
    Result result(db->Select(query));

    if(result.IsValid() && result.Count() == 1)
    {
        csString savedEmail(result[0][0]);

        query.Format("SELECT username FROM accounts WHERE id=%d\n", acctID.Unbox());

        Result result2(db->Select(query));
        if(result2.IsValid() && result2.Count() == 1)
        {
            csString email(result2[0][0]);
            if(savedEmail.CompareNoCase(email))
                return NAME_RESERVED_FOR_YOU;
            else
                return NAME_RESERVED;
        }
    }

    return NAME_AVAILABLE;
}
예제 #4
0
bool PasswordReminder::isEmailValid()
{
	wxString str = m_tbEmail->GetValue();
	gcString email((const wchar_t*)str.c_str());

	return UTIL::MISC::isValidEmail(email.c_str());
}
예제 #5
0
void Desktopwidget::addActions(void)
   {
   // use translatable version of keys
   addAction (_act_duplicate, "&Duplicate", SLOT(duplicate ()), "Ctrl+D");
   addAction (_act_locate, "&Locate folder",  SLOT(locateFolder ()), "Ctrl+L");
   addAction (_act_delete, "D&elete stack",  SLOT(deleteStacks ()), "Delete");

   addAction (_act_stack, "&Stack", SLOT(stackPages()), "Ctrl+G");
   addAction (_act_unstack_page, "Unstack &page", SLOT(unstackPage()), "Ctrl+I");
   addAction (_act_unstack_all, "&Unstack all", SLOT(unstackStacks ()), "Ctrl+U");
   addAction (_act_rename_stack, "&Rename stack", SLOT(renameStack ()), "F2");  //"F2,Ctrl+R");
   addAction (_act_rename_page, "Re&name page", SLOT (renamePage ()), "Shift+F2");

   addAction (_act_duplicate_page, "Duplicate p&age", SLOT (duplicatePage ()), "Ctrl+Shift+I");
   addAction (_act_duplicate_max, "as &Max", SLOT (duplicateMax ()), "Ctrl+Shift+D");
   addAction (_act_duplicate_pdf, "as &PDF", SLOT (duplicatePdf ()), "Ctrl+Shift+P");
   //    addAction (_act_duplicate_tiff, "as &Tiff", SLOT (duplicateTiff ()), "Ctrl+Shift+T");
   addAction (_act_duplicate_odd, "&odd pages only", SLOT (duplicateOdd ()), "");
   addAction (_act_duplicate_even, "&even pages only", SLOT (duplicateEven ()), "");
   addAction (_act_duplicate_jpeg, "as &JPEG", SLOT (duplicateJpeg ()), "Ctrl+Shift+J");

   addAction (_act_email, "&Files", SLOT (email ()), "Ctrl+E");
   addAction (_act_email_pdf, "as &PDF", SLOT (emailPdf ()), "Ctrl+Shift+E");
   addAction (_act_email_max, "as &Max", SLOT (emailMax ()), "Ctrl+Alt+E");
   addAction (_act_send, "&Send stacks", SLOT (send ()), "Ctrl+S");
   addAction (_act_deliver_out, "&Delivery outgoing", SLOT (deliverOut ()), "");
   }
예제 #6
0
TEST(X509CertificateTest, TestSelfSignedGeneration) {
	std::string name("John Doe");
	std::string email("*****@*****.**");
	mumble::X509Certificate cert = mumble::X509Certificate::GenerateSelfSignedCertificate(name, email);
	EXPECT_EQ(name, cert.CommonName());
	EXPECT_EQ(email, cert.EmailAddress());
	EXPECT_TRUE(cert.IsSignedBy(cert));
}
예제 #7
0
  void ClientSession::HandleClientRequestRegistration (yap::IPacket& packet)
  {
    yap::String login (packet.ReadString ());
    yap::String password (packet.ReadString ());
    yap::String email (packet.ReadString ());

    try
    {
      if (user_.Register (login, password, email, socket_.GetRemoteAddress ()))
      {
        yap::Packet registrationValidationPacket;
        registrationValidationPacket.CreateFromType (
          yap::PacketType::ServerInfoRegistrationValidation);
        SendPacket (registrationValidationPacket);

        yap::Packet primaryDataPacket;
        primaryDataPacket.CreateFromType (
          yap::PacketType::ServerInfoPrimaryData);

        SendObjectFactoryTypes (
          primaryDataPacket,
          yap::ObjectFactory::Instance ());

        SendPacket (primaryDataPacket);

        yap::DebugLogger::Instance ().LogLine (
          "New account created: `" + login + "'.");
      }
      else
      {
        yap::Packet registrationErrorPacket;
        registrationErrorPacket.CreateFromType (
          yap::PacketType::ServerInfoRegistrationError);

        SendPacket (registrationErrorPacket);
      }
    }
    catch (const yap::Exception& e)
    {
      e.GetMessage (std::cerr);

      yap::Packet registrationErrorPacket;
      registrationErrorPacket.CreateFromType (
        yap::PacketType::ServerInfoRegistrationError);

      SendPacket (registrationErrorPacket);
    }
    catch (boost::exception& ex)
    {
      std::cout << boost::diagnostic_information (ex) << std::endl;

      yap::Packet registrationErrorPacket;
      registrationErrorPacket.CreateFromType (
        yap::PacketType::ServerInfoRegistrationError);

      SendPacket (registrationErrorPacket);
    }
  }
예제 #8
0
파일: Conf.cpp 프로젝트: asm99/muami
string
Conf::usermail() const
{
    string address;
    if (!conf_from.empty()) {
        address += "\"" + conf_from + "\" ";
    }
    address += "<" + email() + ">";
    return address;
}
예제 #9
0
파일: Address.cpp 프로젝트: asm99/muami
string
Address::usermail() const
{
    string address;
    if (!addr_name.empty()) {
        address += "\"" + addr_name + "\" ";
    }
    address += "<" + email() + ">";
    return address;
}
string AddressBookEntry::toString() const
{
    stringstream ss;
    ss << "Entry(id=" << id()
       << ", name=" << name()
       << ", address=" << address()
       << ", email=" << email()
       << ")";
    return ss.str();
}
예제 #11
0
QString Person::debugInfo() const
{
    QString info;
    info += QLatin1String("### Person: ###################\n");
    info += QLatin1String("name: #") + name() + QLatin1String("#\n");
    info += QLatin1String("email: #") + email() + QLatin1String("#\n");
    info += QLatin1String("uri: #") + uri() + QLatin1String("#\n");
    info += QLatin1String("### Person end ################\n");

    return info;
}
예제 #12
0
void FrmStart::on_pushButton_2_clicked()
{
    FrmURL frmurl;
    QByteArray result;
    int web=0;

    QByteArray  usr = QTextCodec::codecForName("CP-1256")->fromUnicode(ui->Tuser->text());
    QByteArray  mail = QTextCodec::codecForName("CP-1256")->fromUnicode(ui->Tmail->text());
    QString user(usr);
    QString email(mail);

    QUrlQuery postData(Url_php);

    postData.addQueryItem("user",user);
    postData.addQueryItem("email",email);
    if (ui->Op1->isChecked())
        postData.addQueryItem("cmd","login3");
    else
        postData.addQueryItem("cmd","getimtihan");

    frmconn = new frmConnect;
    frmconn->show();
    frmstart->hide();

    result = frmurl.OpenURL(Url_php,&web,postData);
    if(web != 200){
        QMessageBox::information(0,"title","فشل الاتصال لانقطاع الخط حاول من جديد");
        frmconn->close();
        return;
    }
    QString  txt = QTextCodec::codecForName("CP-1256")->toUnicode(result);
    if(txt == ""){
        QMessageBox::information(0,"title","حدث خلل ما الرجاء المحاولة من جديد");
        frmconn->close();
        return;
    }
    txt = TestStr(txt);
    qDebug() << "result: " << txt;

    if (ui->Op1->isChecked()){
       // Call ExtracTxt(TestStr(St))
        frmconn->close();
    }else{
        frmnataij = new FrmNataij;
        frmnataij->show();
        frmstart->hide();
       // FrmNataij.Show
       // Call FrmNataij.ExtracTxt(TestStr(St))
    }


}
예제 #13
0
파일: Conf.cpp 프로젝트: asm99/muami
// DEBUG
void
Conf::dump() const
{
    debug(" --- Account ---");
    debug("fname      : " + fname()      );
    debug("in_server  : " + in_server()  );
    debug("in_port    : " + in_port()    );
    debug("smtp_server: " + smtp_server());
    debug("smtp_port  : " + smtp_port()  );
    debug("from       : " + from()       );
    debug("email      : " + email()      );
    debug("user       : "******"pass       : " + pass()       );
}
예제 #14
0
// MsnBasicSearch - search contacts by e-mail
void __cdecl CMsnProto::MsnSearchAckThread(void* arg)
{
	const TCHAR* emailT = (TCHAR*)arg;
	T2Utf email(emailT);

	if (Lists_IsInList(LIST_FL, email)) {
		MSN_ShowPopup(emailT, TranslateT("Contact already in your contact list"), MSN_ALLOW_MSGBOX, NULL);
		ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
		mir_free(arg);
		return;
	}

	if (MyOptions.netId == NETID_SKYPE) MSN_SKYABSearch(email, arg);
	else {
		unsigned res = MSN_ABContactAdd(email, NULL, NETID_MSN, NULL, 1, true);
		switch (res) {
		case 0:
		case 2:
		case 3:
		{
			PROTOSEARCHRESULT psr = { 0 };
			psr.cbSize = sizeof(psr);
			psr.flags = PSR_TCHAR;
			psr.id.t = (TCHAR*)emailT;
			psr.nick.t = (TCHAR*)emailT;
			psr.email.t = (TCHAR*)emailT;

			ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, arg, (LPARAM)&psr);
			ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
		}
		break;

		case 1:
			if (strstr(email, "@yahoo.com") == NULL)
				ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
	#ifdef OBSOLETE
			else {
				msnSearchId = arg;
				MSN_FindYahooUser(email);
			}
	#endif
			break;

		default:
			ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
			break;
		}
	}
	mir_free(arg);
}
예제 #15
0
int ContactViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 5)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 5;
    }
#ifndef QT_NO_PROPERTIES
    else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0:
            *reinterpret_cast< QString*>(_v) = firstName();
            break;
        case 1:
            *reinterpret_cast< QString*>(_v) = lastName();
            break;
        case 2:
            *reinterpret_cast< QDateTime*>(_v) = birthday();
            break;
        case 3:
            *reinterpret_cast< QString*>(_v) = formattedBirthday();
            break;
        case 4:
            *reinterpret_cast< QString*>(_v) = email();
            break;
        }
        _id -= 5;
    } else if (_c == QMetaObject::WriteProperty) {
        _id -= 5;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 5;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
예제 #16
0
void PeopleApplication::emailToActiveService(const QString& address){
    qDebug() << "Attempting to compose Email to" << address;

    // hard-coded details of the MeeGo Email application
    QDBusInterface email("com.meego.email", "/", "com.meego.email");
    if (!email.isValid()) {
        qWarning() << "Composing Email to" << address << "- could not find Email app";
        return;
    }

    QDBusReply<void> reply = email.call(QDBus::BlockWithGui, "showComposePage", address);
    if (!reply.isValid())
        qWarning() << "Composing Email to" << address << "failed:" <<
                reply.error().message();
}
예제 #17
0
파일: shell.c 프로젝트: Estella/wraith
void baduname(char *confhas, char *myuname) {
  char *tmpFile = NULL;
  int tosend = 0, make = 0;
  size_t siz = strlen(tempdir) + 3 + 1;

  tmpFile = (char *) my_calloc(1, siz);

  simple_snprintf(tmpFile, siz, STR("%s/.un"), conf.datadir);
  if (is_file(tmpFile)) {
    struct stat ss;
    time_t diff;

    stat(tmpFile, &ss);
    diff = now - ss.st_mtime;
    if (diff >= 86400) {
      tosend++;          		/* only send once a day */
      unlink(tmpFile);		/* remove file */
      make++;			/* make a new one at thie time. */
    }
  } else {
    make++;
  }

  if (make) {
    FILE *fp = NULL;
    if ((fp = fopen(tmpFile, "w"))) {
      fprintf(fp, "\n");
      fflush(fp);
      fclose(fp);
      tosend++;           /* only send if we could write the file. */
    }
  }

  if (tosend) {
    struct utsname un;
    char msg[1024] = "", subject[31] = "";

    uname(&un);
    simple_snprintf(subject, sizeof subject, STR("CONF/UNAME() mismatch notice"));
    simple_snprintf(msg, sizeof msg, STR("This is an auto email from a wraith bot which has you in it's OWNER_EMAIL list..\n \nThe uname() output on this box has changed, probably due to a kernel upgrade...\nMy login is: %s\nMy binary is: %s\nLocalhub: %s\nConf   : %s\nUname(): %s\n \nThis email will only be sent once a day while this error is present.\nYou need to login to my shell (%s) and fix my local config.\n"), 
                                  conf.username ? conf.username : "******", 
                                  binname,
                                  conf.bots && conf.bots->nick ? conf.bots->nick : origbotname,
                                  confhas, myuname, un.nodename);
    email(subject, msg, EMAIL_OWNERS);
  }
  free(tmpFile);
}
예제 #18
0
void __cdecl CSkypeProto::SearchByEmailAsync(void* arg)
{
	mir_ptr<wchar_t> email((wchar_t *)arg);

	CContactSearch::Ref search;
	this->CreateContactSearch(search);
	search.fetch();
	search->SetProtoInfo((HANDLE)SKYPE_SEARCH_BYEMAIL);

	bool valid;
	if (!search->AddEmailTerm(::mir_u2a(email), valid) || !valid || !search->Submit())
		return; 

	search->BlockWhileSearch();
	search->Release();
}
예제 #19
0
void DetailMeeting::sendEmailUpdateMeeting(int id_meeting,QString date)
{
    global_settings = new QSettings("../Thunderlook/data/settings/settings.ini", QSettings::IniFormat);

    if(global_settings->value("Send/smtp_security").toInt() == 1)
        smtp = new SmtpClient(global_settings->value("Send/smtp_server").toString(), global_settings->value("Send/smtp_port").toInt(), SmtpClient::SslConnection);
    else
        smtp = new SmtpClient(global_settings->value("Send/smtp_server").toString(), global_settings->value("Send/smtp_port").toInt());

    smtp->setUser(global_settings->value("Send/smtp_user").toString());
    smtp->setPassword(global_settings->value("Send/smtp_password").toString());

    QSqlQuery query;
    QString sql("SELECT * FROM Meeting,Users,UsersMeeting where id_meeting = " + QString::number(id_meeting));
    query.prepare("SELECT * FROM Meeting,Users,UsersMeeting where id_meeting = :id_meeting AND UsersMeeting.id_user = Users.id AND UsersMeeting.id_meeting = Meeting.id");
    query.bindValue(":id_meeting", id_meeting);
    query.exec();
    QSqlRecord rec = query.record();

    smtp->connectToHost();
    smtp->login();
    while(query.next())
    {
        MimeMessage message;

        message.setSender(new EmailAddress(
                              global_settings->value("Account/user_email").toString(),
                              global_settings->value("Account/user_name").toString()
                              ));

        QString email(query.value(rec.indexOf("address")).toString());
        message.addRecipient(new EmailAddress(query.value(rec.indexOf("address")).toString(), ""));
        message.setSubject("Modification horaire d'une reunion");

        MimeHtml * text = new MimeHtml;
        text->setHtml("<html><b>La réunion planifié le " + date  + " a été modifié.</b></html>");

        message.addPart(text);

        smtp->sendMail(message);
    }
    smtp->quit();

    close();
}
예제 #20
0
TEST(X509CertificateTest, TestExportPKCS12NoPassword) {
	std::string name("John Doe");
	std::string email("*****@*****.**");

	mumble::X509Certificate leaf = mumble::X509Certificate::GenerateSelfSignedCertificate(name, email);
	std::vector<mumble::X509Certificate> export_chain;
	export_chain.push_back(leaf);

	mumble::ByteArray pkcs12 = mumble::X509Certificate::ExportCertificateChainAsPKCS12(export_chain, std::string());
	ASSERT_TRUE(pkcs12.Length() > 0);

	std::vector<mumble::X509Certificate> import_chain = mumble::X509Certificate::FromPKCS12(pkcs12, std::string());
	ASSERT_EQ(1, import_chain.size());

	EXPECT_EQ(name, import_chain.at(0).CommonName());
	EXPECT_EQ(email, import_chain.at(0).EmailAddress());
	EXPECT_TRUE(import_chain.at(0).IsSignedBy(import_chain.at(0)));
}
void AddContactWidget::on_addContactButton_clicked()
{
	QRegExp rx("^[\\w\\d][\\w\\d\\-.]*@[\\w\\d]{2}[\\w\\d\\-]*.[\\w\\d]{2}(\\.?[\\w\\d\\-]+)*$");
	int pos;
	QRegExpValidator emailValidator(rx,0);
	QString email(ui.emailEdit->text());
	if (emailValidator.validate(email,pos) == QValidator::Acceptable)
	{
		m_selctedGrId = ui.groupComboBox->itemData(ui.groupComboBox->currentIndex()).toUInt();		
		m_contactEmail = ui.emailEdit->text();
                m_client->Protocol()->AddContact(GetContactEmail(),GetNickname(),GetSelectedGroupId());
                close();
	}
	else
	{
		QMessageBox::critical(this,tr("Incorrect email"),tr("Email you entered is not valid or empty!"),QMessageBox::Ok,QMessageBox::Ok);
	}
}
예제 #22
0
파일: email.c 프로젝트: lupinQ/la-vie
int main(int argc, const char *argv[])
{
    FILE *fp = fopen("wangye.html", "r");
    if (!fp) {
	printf("文件不存在!");
	return 0;
    }
    while (!feof(fp)) {

	char str[1024] = { 0 };
	fgets(str, sizeof(str), fp);
	email(str);

    }
    if (fp)
	fclose(fp);

    return 0;
}
예제 #23
0
void UserDialog::addUser()
{
    QSqlRecord record;

    QSqlField id("id", QVariant::Int);
    QSqlField username("username", QVariant::String);
    QSqlField email("email", QVariant::String);
    QSqlField hashedPassword("hashed_password", QVariant::String);
    QSqlField salt("salt", QVariant::String);
    QSqlField roleId("role_id", QVariant::Int);

    id.setAutoValue(true);
    username.setValue(QVariant(usernameLineEdit->text()));
    email.setValue(QVariant(emailLineEdit->text()));

    QString generatedSalt = QUuid::createUuid().toString();
    QString generatedHashedPassword = QCryptographicHash::hash(passwordLineEdit->text().toAscii()
                                                               + generatedSalt.toAscii(),
                                                               QCryptographicHash::Sha1);

    hashedPassword.setValue(QVariant(generatedHashedPassword));
    salt.setValue(QVariant(generatedSalt));
    roleId.setValue(QVariant(getRoleId()));

    record.append(id);
    record.append(username);
    record.append(email);
    record.append(hashedPassword);
    record.append(salt);
    record.append(roleId);

    if(isFieldInputValid()
        && !isPasswordEmpty()
        && !userExists()
        && userModel->insertRecord(-1, record))
    {
        accept();
    }
    else
    {
        userModel->revertAll();
    }
}
예제 #24
0
uint DbusAdapter::Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantHash &hints, int expire_timeout) {
    qDebug() << "Got notification via dbus from" << app_name;

    if (app_name == "messageserver5") {
        qDebug() << "Got notification from messageserver5, assuming e-mail.";

        emit email(hints.value("x-nemo-preview-summary", "default").toString(),
                   hints.value("x-nemo-preview-body", "default").toString(),
                   hints.value("x-nemo.email.published-messages", "default").toString());
    } else if (app_name == "commhistoryd") {
        if (summary == "" && body == "") {
            emit commhistoryd(hints.value("x-nemo-preview-summary", "default").toString(),
                              hints.value("x-nemo-preview-body", "default").toString());
        } else {
            qDebug() << "Ignoring this commhistoryd message:" << summary << ";" << body << ";" << hints;
        }
    } else {
        emit notify(app_name, summary, body);
    }
}
예제 #25
0
파일: inetmsg.cpp 프로젝트: bhaggerty/wwiv
void send_inet_email() {
  if (GetSession()->GetCurrentUser()->GetNumEmailSentToday() > getslrec(GetSession()->GetEffectiveSl()).emails) {
    GetSession()->bout.NewLine();
    GetSession()->bout << "|#6Too much mail sent today.\r\n";
    return;
  }
  write_inst(INST_LOC_EMAIL, 0, INST_FLAGS_NONE);
  int nNetworkNumber = getnetnum("FILEnet");
  GetSession()->SetNetworkNumber(nNetworkNumber);
  if (nNetworkNumber == -1) {
    return;
  }
  set_net_num(GetSession()->GetNetworkNumber());
  GetSession()->bout.NewLine();
  GetSession()->bout << "|#9Your Internet Address:|#1 " <<
                     (GetSession()->IsInternetUseRealNames() ? GetSession()->GetCurrentUser()->GetRealName() :
                      GetSession()->GetCurrentUser()->GetName()) <<
                     " <" << GetSession()->internetFullEmailAddress << ">";
  GetSession()->bout.NewLine(2);
  GetSession()->bout << "|#9Enter the Internet mail destination address.\r\n|#7:";
  inputl(net_email_name, 75, true);
  if (check_inet_addr(net_email_name)) {
    unsigned short nUserNumber = 0;
    unsigned short nSystemNumber = 32767;
    irt[0] = 0;
    irt_name[0] = 0;
    grab_quotes(NULL, NULL);
    if (nUserNumber || nSystemNumber) {
      email(nUserNumber, nSystemNumber, false, 0);
    }
  } else {
    GetSession()->bout.NewLine();
    if (net_email_name[0]) {
      GetSession()->bout << "|#6Invalid address format!\r\n";
    } else {
      GetSession()->bout << "|#6Aborted.\r\n";
    }
  }
}
예제 #26
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    createStatusBar();

    // Recent files
    for (int i = 0; i < MaxRecentFiles; ++i)
    {
	recentFileActions[i] = new QAction(this);
	recentFileActions[i]->setVisible(false);
	connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile()));
	ui->menuFile->insertAction(ui->actionExit, recentFileActions[i]);
    }
    recentFilesSeparator = ui->menuFile->insertSeparator(ui->actionExit);

    printer = new QPrinter;
    printer->setFullPage(true);
    printer->setPaperSize(QPrinter::Letter);
    printer->setPageMargins(.5, .5, .5, .5, QPrinter::Inch);

    report = new Report(printer, this);
    view = new ReportView(report, this);

    preview = new QPrintPreviewWidget(printer, this);
    setCentralWidget(preview);
    preview->fitToWidth();

    QFontComboBox* fontComboBox = new QFontComboBox;
    fontComboBox->setFontFilters(QFontComboBox::MonospacedFonts | QFontComboBox::ScalableFonts);
    fontComboBox->setCurrentFont(report->font().family());
    ui->fontToolBar->insertWidget(ui->actionBold, fontComboBox);
    connect(fontComboBox, SIGNAL(currentFontChanged(QFont)), report, SLOT(setFont(QFont)));

    pageNumberComboBox = new QComboBox;
    ui->viewToolBar->insertWidget(ui->actionNextPage, pageNumberComboBox);
    connect(pageNumberComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentPageChanged(int)));

    const qreal zoomFactors[] = { 12.5, 25, 50, 100, 125, 150, 200, 400, 800 };
    zoomComboBox = new QComboBox;
    for (unsigned int i = 0; i < sizeof(zoomFactors) / sizeof(*zoomFactors); ++i)
    {
	zoomComboBox->addItem(QString("%1%").arg(zoomFactors[i]));
    }
    zoomComboBox->setCurrentIndex(-1);
    ui->viewToolBar->insertWidget(ui->actionZoomOut, zoomComboBox);
    connect(zoomComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(zoomChanged(QString)));

    QActionGroup* orientationGroup = new QActionGroup(this);
    orientationGroup->addAction(ui->actionPortrait);
    orientationGroup->addAction(ui->actionLandscape);
    orientationChanged(report->orientation());

    QActionGroup* heightGroup = new QActionGroup(this);
    heightGroup->addAction(ui->action6LPI);
    heightGroup->addAction(ui->action8LPI);
    heightGroup->addAction(ui->action9LPI);
    heightGroup->setDisabled(ui->actionStretchFont->isEnabled());
    connect(ui->actionStretchFont, SIGNAL(toggled(bool)), heightGroup, SLOT(setDisabled(bool)));

    QActionGroup* widthGroup = new QActionGroup(this);
    widthGroup->addAction(ui->actionDefaultWidth);
    widthGroup->addAction(ui->action10CPI);
    widthGroup->addAction(ui->action12CPI);
    widthGroup->addAction(ui->action17CPI);
    widthGroup->setDisabled(ui->actionStretchFont->isEnabled());
    connect(ui->actionStretchFont, SIGNAL(toggled(bool)), widthGroup, SLOT(setDisabled(bool)));

    QActionGroup* pageGroup = new QActionGroup(this);
    pageGroup->addAction(ui->actionSinglePage);
    pageGroup->addAction(ui->actionFacingPages);
    pageGroup->addAction(ui->actionAllPages);
    ui->actionSinglePage->setChecked(preview->viewMode() == QPrintPreviewWidget::SinglePageView);
    ui->actionFacingPages->setChecked(preview->viewMode() == QPrintPreviewWidget::FacingPagesView);
    ui->actionAllPages->setChecked(preview->viewMode() == QPrintPreviewWidget::AllPagesView);

    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
    connect(ui->actionOpenURL, SIGNAL(triggered()), this, SLOT(openUrl()));
    connect(ui->actionReload, SIGNAL(triggered()), this, SLOT(reload()));
    connect(ui->actionSaveAsPDF, SIGNAL(triggered()), this, SLOT(saveAsPdf()));
    connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
    connect(ui->actionPageSetup, SIGNAL(triggered()), this, SLOT(pageSetup()));
    connect(ui->actionEmail, SIGNAL(triggered()), this, SLOT(email()));
    connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(copy()));
    connect(ui->actionStretchFont, SIGNAL(toggled(bool)), report, SLOT(setStretchFont(bool)));
    connect(report, SIGNAL(stretchFontChanged(bool)), ui->actionStretchFont, SLOT(setChecked(bool)));
    connect(ui->actionBold, SIGNAL(toggled(bool)), report, SLOT(setBold(bool)));
    connect(ui->actionStripes, SIGNAL(toggled(bool)), report, SLOT(setStripes(bool)));
    connect(ui->actionStripeColor, SIGNAL(triggered()), this, SLOT(stripeColor()));
    connect(ui->actionColor, SIGNAL(triggered()), this, SLOT(fontColor()));
    connect(ui->action6LPI, SIGNAL(triggered()), this, SLOT(height6Lpi()));
    connect(ui->action8LPI, SIGNAL(triggered()), this, SLOT(height8Lpi()));
    connect(ui->action9LPI, SIGNAL(triggered()), this, SLOT(height9Lpi()));
    connect(ui->actionDefaultWidth, SIGNAL(toggled(bool)), this, SLOT(widthDefault()));
    connect(ui->action10CPI, SIGNAL(triggered()), this, SLOT(width10Cpi()));
    connect(ui->action12CPI, SIGNAL(triggered()), this, SLOT(width12Cpi()));
    connect(ui->action17CPI, SIGNAL(triggered()), this, SLOT(width17Cpi()));
    connect(ui->actionFirstPage, SIGNAL(triggered()), this, SLOT(firstPage()));
    connect(ui->actionPreviousPage, SIGNAL(triggered()), this, SLOT(previousPage()));
    connect(ui->actionNextPage, SIGNAL(triggered()), this, SLOT(nextPage()));
    connect(ui->actionLastPage, SIGNAL(triggered()), this, SLOT(lastPage()));
    connect(ui->actionFitWidth, SIGNAL(triggered()), preview, SLOT(fitToWidth()));
    connect(ui->actionFitHeight, SIGNAL(triggered()), preview, SLOT(fitInView()));
    connect(ui->actionPortrait, SIGNAL(triggered()), preview, SLOT(setPortraitOrientation()));
    connect(ui->actionLandscape, SIGNAL(triggered()), preview, SLOT(setLandscapeOrientation()));
    connect(ui->actionActualSize, SIGNAL(triggered()), this, SLOT(actualSize()));
    connect(ui->actionZoomIn, SIGNAL(triggered()), preview, SLOT(zoomIn()));
    connect(ui->actionZoomOut, SIGNAL(triggered()), preview, SLOT(zoomOut()));
    connect(ui->actionSinglePage, SIGNAL(triggered()), preview, SLOT(setSinglePageViewMode()));
    connect(ui->actionFacingPages, SIGNAL(triggered()), preview, SLOT(setFacingPagesViewMode()));
    connect(ui->actionAllPages, SIGNAL(triggered()), preview, SLOT(setAllPagesViewMode()));
    connect(ui->actionMainToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleMainToolbar(bool)));
    connect(ui->actionViewToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleViewToolbar(bool)));
    connect(ui->actionFontToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleFontToolbar(bool)));
    connect(ui->actionStatusBar, SIGNAL(triggered(bool)), this, SLOT(toggleStatusBar(bool)));
    connect(ui->menuToolbars, SIGNAL(aboutToShow()), this, SLOT(updateToolbarMenu()));
    connect(ui->menuView, SIGNAL(aboutToShow()), this, SLOT(updateToolbarMenu()));
    connect(preview, SIGNAL(previewChanged()), this, SLOT(previewChanged()));

    connect(preview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paint(QPrinter*)));
    connect(report, SIGNAL(loaded()), preview, SLOT(updatePreview()));
    connect(report, SIGNAL(changed()), preview, SLOT(updatePreview()));
    connect(report, SIGNAL(loaded()), this, SLOT(documentLoaded()));
    connect(report, SIGNAL(orientationChanged(QPrinter::Orientation)), this, SLOT(orientationChanged(QPrinter::Orientation)));
    connect(report, SIGNAL(lpiChanged(int)), this, SLOT(lpiChanged(int)));
    connect(report, SIGNAL(cpiChanged(int)), this, SLOT(cpiChanged(int)));
    connect(report, SIGNAL(boldChanged(bool)), ui->actionBold, SLOT(setChecked(bool)));
    connect(report, SIGNAL(fontChanged(QFont)), fontComboBox, SLOT(setCurrentFont(QFont)));

    QSettings settings;
    restoreGeometry(settings.value("geometry").toByteArray());
    restoreState(settings.value("state").toByteArray());
    recentFiles = settings.value("recentFiles").toStringList();
    currentFolder = settings.value("currentFolder").toString();
    ui->statusBar->setVisible(settings.value("statusBar", true).toBool());

    updateRecentFileActions();

    zoomTimer = new QTimer(this);
    connect(zoomTimer, SIGNAL(timeout()), this, SLOT(updateZoom()));
    connect(preview, SIGNAL(previewChanged()), this, SLOT(updateZoom()));
    zoomTimer->start(1000);
}
예제 #27
0
파일: compose.cpp 프로젝트: bomboom/foxmail
void compose::contextSendButton()
{
    QString str=Toedit->text();
    rcpts=str.split(";");    //邮件接受者地址以";"分隔
    ccs=Ccedit->text().split(";");
    bccs=Bccedit->text().split(";");
    QStringList to=rcpts+ccs+bccs;

    //QString host=ui->host->text();
    //int port=25;
    QString host, password, sender;
    int port;
    QString user=from->currentText();
    QString portstr;
    QFile file("account.txt");

    if (file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
       QString read;
       QStringList str;

       while(!file.atEnd())
       {
            read=file.readLine();
            str=read.split(" ");
            if(user.compare(str.at(0))==0)
            {
                sender=str.at(0);
                //Ccedit->setText(sender);
                password=str.at(1);
                //Bccedit->setText(password);
                host = str.at(6);
                //qDebug()<<host<<"host";
                portstr=str.at(7);
                //qDebug()<<portstr<<"port";
                break;
            }
       }
     }
    file.close();
    bool ok1;
    ok1=true;
    port=portstr.toInt(&ok1,10);
    //qDebug()<<port;
    //QString password=ui->password->text();
    //QString sender=Toedit->text();
    QString subject=Subjectedit->text();
    QString content=letter->toPlainText();         //接收ui中输入的内容

   MailContent email(sender,rcpts,ccs,bccs,subject,content);

    for (int i = 0; i < attachlist->count(); ++i)
    {
        email.addAttachment(new Attachment(new QFile(attachlist->item(i)->text())));
    }

    Smtp smtp(host,port,user,password,sender,to);
    smtp.connectToHost();
    smtp.login();

    tipDialog *tipdialog = new tipDialog(this);
    tipdialog->setWindowModality(Qt::ApplicationModal);
    tipdialog->setQString("Sending....");
    tipdialog->show();

    QCoreApplication::processEvents();

    if(smtp.sendMail(email))
    {
        tipdialog->setQString("Send Successfully");
        smtp.saveSendMail(email, "sent");
    }else
    {
        tipdialog->setQString("Send Failed");
        smtp.saveSendMail(email, "draft");
    }

    smtp.quit();


}
예제 #28
0
void sbbs_t::readmail(uint usernumber, int which)
{
	char	str[256],str2[256],str3[256],done=0,domsg=1
			,*p,*tp,*sp,ch;
	char 	tmp[512];
	int		i,j;
	int		error;
	int		mismatches=0,act;
    long    length,l,lm_mode;
	ulong	last;
	bool	replied;
	file_t	fd;
	mail_t	*mail;
	smbmsg_t msg;

	if(which==MAIL_SENT && useron.rest&FLAG('K')) {
		bputs(text[R_ReadSentMail]);
		return;
	}

	msg.total_hfields=0;			/* init to NULL, cause not allocated yet */

	fd.dir=cfg.total_dirs+1;			/* temp dir for file attachments */

	if((i=smb_stack(&smb,SMB_STACK_PUSH))!=0) {
		errormsg(WHERE,ERR_OPEN,"MAIL",i);
		return; }
	sprintf(smb.file,"%smail",cfg.data_dir);
	smb.retry_time=cfg.smb_retry_time;
	smb.subnum=INVALID_SUB;
	if((i=smb_open(&smb))!=0) {
		smb_stack(&smb,SMB_STACK_POP);
		errormsg(WHERE,ERR_OPEN,smb.file,i,smb.last_error);
		return; }

	if(cfg.sys_misc&SM_SYSVDELM && (SYSOP || cfg.sys_misc&SM_USRVDELM))
		lm_mode=LM_INCDEL;
	else
		lm_mode=0;
	mail=loadmail(&smb,&smb.msgs,usernumber,which,lm_mode);
	if(!smb.msgs) {
		if(which==MAIL_SENT)
			bputs(text[NoMailSent]);
		else if(which==MAIL_ALL)
			bputs(text[NoMailOnSystem]);
		else
			bputs(text[NoMailWaiting]);
		smb_close(&smb);
		smb_stack(&smb,SMB_STACK_POP);
		return; }

	last=smb.status.last_msg;

	if(which==MAIL_SENT)
		act=NODE_RSML;
	else if(which==MAIL_ALL)
		act=NODE_SYSP;
	else
		act=NODE_RMAL;
	action=act;
	if(smb.msgs>1 && which!=MAIL_ALL) {
		if(which==MAIL_SENT)
			bputs(text[MailSentLstHdr]);
		else
			bputs(text[MailWaitingLstHdr]);

		for(smb.curmsg=0;smb.curmsg<smb.msgs && !msgabort();smb.curmsg++) {
			if(msg.total_hfields)
				smb_freemsgmem(&msg);
			msg.total_hfields=0;
			msg.idx.offset=mail[smb.curmsg].offset;
			if(!loadmsg(&msg,mail[smb.curmsg].number))
				continue;
			smb_unlockmsghdr(&smb,&msg);
			bprintf(text[MailWaitingLstFmt],smb.curmsg+1
				,which==MAIL_SENT ? msg.to
				: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP ? text[Anonymous]
				: msg.from
				,msg.hdr.attr&MSG_DELETE ? '-' : msg.hdr.attr&MSG_REPLIED ? 'R'
					: msg.hdr.attr&MSG_READ ? ' '
					: msg.from_net.type || msg.to_net.type ? 'N':'*'
				,msg.subj);
			smb_freemsgmem(&msg);
			msg.total_hfields=0; }

		ASYNC;
		if(!(sys_status&SS_ABORT)) {
			bprintf(text[StartWithN],1L);
			if((long)(smb.curmsg=getnum(smb.msgs))>0)
				smb.curmsg--;
			else if((long)smb.curmsg==-1) {
				free(mail);
				smb_close(&smb);
				smb_stack(&smb,SMB_STACK_POP);
				return; } }
		sys_status&=~SS_ABORT; }
	else {
		smb.curmsg=0;
		if(which==MAIL_ALL)
			domsg=0; }
	if(which==MAIL_SENT) {
		sprintf(str,"%s read sent mail",useron.alias);
		logline("E",str);
	} else if(which==MAIL_ALL) {
		sprintf(str,"%s read all mail",useron.alias);
		logline("S+",str);
	} else {
		sprintf(str,"%s read mail",useron.alias);
		logline("E",str);
	}
	if(useron.misc&RIP) {
		strcpy(str,which==MAIL_YOUR ? "mailread" : which==MAIL_ALL ?
			"allmail" : "sentmail");
		menu(str); }
	while(online && !done) {
		action=act;

		if(msg.total_hfields)
			smb_freemsgmem(&msg);
		msg.total_hfields=0;

		msg.idx.offset=mail[smb.curmsg].offset;
		msg.idx.number=mail[smb.curmsg].number;
		msg.idx.to=mail[smb.curmsg].to;
		msg.idx.from=mail[smb.curmsg].from;
		msg.idx.subj=mail[smb.curmsg].subj;

		if((i=smb_locksmbhdr(&smb))!=0) {
			errormsg(WHERE,ERR_LOCK,smb.file,i);
			break; }

		if((i=smb_getstatus(&smb))!=0) {
			smb_unlocksmbhdr(&smb);
			errormsg(WHERE,ERR_READ,smb.file,i);
			break; }
		smb_unlocksmbhdr(&smb);

		if(smb.status.last_msg!=last) { 	/* New messages */
			last=smb.status.last_msg;
			free(mail);
			mail=loadmail(&smb,&smb.msgs,usernumber,which,lm_mode);   /* So re-load */
			if(!smb.msgs)
				break;
			for(smb.curmsg=0;smb.curmsg<smb.msgs;smb.curmsg++)
				if(mail[smb.curmsg].number==msg.idx.number)
					break;
			if(smb.curmsg>=smb.msgs)
				smb.curmsg=(smb.msgs-1);
			continue; }

		if(!loadmsg(&msg,mail[smb.curmsg].number)) {	/* Message header gone */
			if(mismatches>5) {	/* We can't do this too many times in a row */
				errormsg(WHERE,ERR_CHK,"message number",mail[smb.curmsg].number);
				break; }
			free(mail);
			mail=loadmail(&smb,&smb.msgs,usernumber,which,lm_mode);
			if(!smb.msgs)
				break;
			if(smb.curmsg>(smb.msgs-1))
				smb.curmsg=(smb.msgs-1);
			mismatches++;
			continue; }
		smb_unlockmsghdr(&smb,&msg);
		msg.idx.attr=msg.hdr.attr;

		mismatches=0;

		if(domsg && !(sys_status&SS_ABORT)) {

			show_msg(&msg
				,msg.from_ext && msg.idx.from==1 && !msg.from_net.type
					? 0:P_NOATCODES);

			if(msg.hdr.auxattr&MSG_FILEATTACH) {  /* Attached file */
				smb_getmsgidx(&smb,&msg);
				strcpy(str,msg.subj);					/* filenames in title */
//				strupr(str);
				tp=str;
				while(online) {
					p=strchr(tp,' ');
					if(p) *p=0;
					sp=strrchr(tp,'/');              /* sp is slash pointer */
					if(!sp) sp=strrchr(tp,'\\');
					if(sp) tp=sp+1;
					padfname(tp,fd.name);
					sprintf(str2,"%sfile/%04u.in/%s"  /* str2 is path/fname */
						,cfg.data_dir,msg.idx.to,tp);
					length=flength(str2);
					if(length<1)
						bputs(text[FileNotFound]);
					else if(!(useron.exempt&FLAG('T')) && cur_cps && !SYSOP
						&& length/(long)cur_cps>(time_t)timeleft)
						bputs(text[NotEnoughTimeToDl]);
					else {
						sprintf(str3,text[DownloadAttachedFileQ]
							,tp,ultoac(length,tmp));
						if(length>0L && yesno(str3)) {
#if 0	/* no such thing as local logon */
							if(online==ON_LOCAL) {
								bputs(text[EnterPath]);
								if(getstr(str3,60,K_LINE)) {
									backslashcolon(str3);
									sprintf(tmp,"%s%s",str3,tp);
									if(!mv(str2,tmp,which!=MAIL_YOUR)) {
										logon_dlb+=length;
										logon_dls++;
										useron.dls=(ushort)adjustuserrec(&cfg,useron.number
											,U_DLS,5,1);
										useron.dlb=adjustuserrec(&cfg,useron.number
											,U_DLB,10,length);
										bprintf(text[FileNBytesSent]
											,fd.name,ultoac(length,tmp)); } } }

							else 
#endif
							{	/* Remote User */
								xfer_prot_menu(XFER_DOWNLOAD);
								mnemonics(text[ProtocolOrQuit]);
								strcpy(str3,"Q");
								for(i=0;i<cfg.total_prots;i++)
									if(cfg.prot[i]->dlcmd[0]
										&& chk_ar(cfg.prot[i]->ar,&useron)) {
										sprintf(tmp,"%c",cfg.prot[i]->mnemonic);
										strcat(str3,tmp); }
								ch=(char)getkeys(str3,0);
								for(i=0;i<cfg.total_prots;i++)
									if(cfg.prot[i]->dlcmd[0] && ch==cfg.prot[i]->mnemonic
										&& chk_ar(cfg.prot[i]->ar,&useron))
										break;
								if(i<cfg.total_prots) {
									error=protocol(cfg.prot[i],XFER_DOWNLOAD,str2,nulstr,false);
									if(checkprotresult(cfg.prot[i],error,&fd)) {
										if(which==MAIL_YOUR)
											remove(str2);
										logon_dlb+=length;	/* Update stats */
										logon_dls++;
										useron.dls=(ushort)adjustuserrec(&cfg,useron.number
											,U_DLS,5,1);
										useron.dlb=adjustuserrec(&cfg,useron.number
											,U_DLB,10,length);
										bprintf(text[FileNBytesSent]
											,fd.name,ultoac(length,tmp));
										sprintf(str3
											,"%s downloaded attached file: %s"
											,useron.alias
											,fd.name);
										logline("D-",str3); 
									}
									autohangup(); 
								} 
							} 
						} 
					}
					if(!p)
						break;
					tp=p+1;
					while(*tp==' ') tp++; 
				}
				sprintf(str,"%sfile/%04u.in",cfg.data_dir,usernumber);
				rmdir(str); }
			if(which==MAIL_YOUR && !(msg.hdr.attr&MSG_READ)) {
				mail[smb.curmsg].attr|=MSG_READ;
				if(thisnode.status==NODE_INUSE)
					telluser(&msg);
				if(msg.total_hfields)
					smb_freemsgmem(&msg);
				msg.total_hfields=0;
				msg.idx.offset=0;						/* Search by number */
				if(smb_locksmbhdr(&smb)==SMB_SUCCESS) {	/* Lock the entire base */
					if(loadmsg(&msg,msg.idx.number)) {
						msg.hdr.attr|=MSG_READ;
						msg.idx.attr=msg.hdr.attr;
						if((i=smb_putmsg(&smb,&msg))!=0)
							errormsg(WHERE,ERR_WRITE,smb.file,i);
						smb_unlockmsghdr(&smb,&msg); }
					smb_unlocksmbhdr(&smb); }
				if(!msg.total_hfields) {				/* unsuccessful reload */
					domsg=0;
					continue; } }
			}
		else domsg=1;

		if(useron.misc&WIP) {
			strcpy(str,which==MAIL_YOUR ? "mailread" : which==MAIL_ALL ?
				"allmail" : "sentmail");
			menu(str); }

		ASYNC;
		if(which==MAIL_SENT)
			bprintf(text[ReadingSentMail],smb.curmsg+1,smb.msgs);
		else if(which==MAIL_ALL)
			bprintf(text[ReadingAllMail],smb.curmsg+1,smb.msgs);
		else
			bprintf(text[ReadingMail],smb.curmsg+1,smb.msgs);
		sprintf(str,"ADFLNQRT?<>[]{}-+");
		if(SYSOP)
			strcat(str,"CUSPH");
		if(which!=MAIL_YOUR)
			strcat(str,"E");
		l=getkeys(str,smb.msgs);
		if(l&0x80000000L) {
			if(l==-1)	/* ctrl-c */
				break;
			smb.curmsg=(l&~0x80000000L)-1;
			continue; }
		switch(l) {
			case 'A':   /* Auto-reply to last piece */
			case 'R':
				if(l==(cfg.sys_misc&SM_RA_EMU ? 'A' : 'R'))  /* re-read last message */
					break;

				if(which==MAIL_SENT)
					break;
				if((msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP) {
					bputs(text[CantReplyToAnonMsg]);
					break; }

				quotemsg(&msg,1);

				if(msg.from_net.addr==NULL)
					SAFECOPY(str,msg.from);
				else if(msg.from_net.type==NET_FIDO) 	/* FidoNet type */
					SAFEPRINTF2(str,"%s@%s",msg.from
						,smb_faddrtoa((faddr_t *)msg.from_net.addr,tmp));
				else if(msg.from_net.type==NET_INTERNET) {
					if(msg.replyto_net.type==NET_INTERNET)
						SAFECOPY(str,(char *)msg.replyto_net.addr);
					else
						SAFECOPY(str,(char *)msg.from_net.addr);
				} else
					SAFEPRINTF2(str,"%s@%s",msg.from,(char*)msg.from_net.addr);

				SAFECOPY(str2,str);

				bputs(text[Email]);
				if(!getstr(str,64,K_EDIT|K_AUTODEL))
					break;
				msg.hdr.number=msg.idx.number;
				smb_getmsgidx(&smb,&msg);

				if(!stricmp(str2,str))		/* Reply to sender */
					sprintf(str2,text[Regarding],msg.subj);
				else						/* Reply to other */
					sprintf(str2,text[RegardingByOn],msg.subj,msg.from
						,timestr((time_t *)&msg.hdr.when_written.time));

				p=strrchr(str,'@');
				if(p) { 							/* name @addr */
					replied=netmail(str,msg.subj,WM_QUOTE);
					sprintf(str2,text[DeleteMailQ],msg.from); }
				else {
					if(!msg.from_net.type && !stricmp(str,msg.from))
						replied=email(msg.idx.from,str2,msg.subj,WM_EMAIL|WM_QUOTE);
					else if(!stricmp(str,"SYSOP"))
						replied=email(1,str2,msg.subj,WM_EMAIL|WM_QUOTE);
					else if((i=finduser(str))!=0)
						replied=email(i,str2,msg.subj,WM_EMAIL|WM_QUOTE);
					else
						replied=false;
					sprintf(str2,text[DeleteMailQ],msg.from); }

				if(replied==true && !(msg.hdr.attr&MSG_REPLIED)) {
					if(msg.total_hfields)
						smb_freemsgmem(&msg);
					msg.total_hfields=0;
					msg.idx.offset=0;
					if(smb_locksmbhdr(&smb)==SMB_SUCCESS) {	/* Lock the entire base */
						if(loadmsg(&msg,msg.idx.number)) {
							msg.hdr.attr|=MSG_REPLIED;
							msg.idx.attr=msg.hdr.attr;
							if((i=smb_putmsg(&smb,&msg))!=0)
								errormsg(WHERE,ERR_WRITE,smb.file,i);
							smb_unlockmsghdr(&smb,&msg); 
						}
						smb_unlocksmbhdr(&smb);
					}
				}

				if(msg.hdr.attr&MSG_DELETE || !yesno(str2)) {
					if(smb.curmsg<smb.msgs-1) smb.curmsg++;
					else done=1;
					break;	}
				/* Case 'D': must follow! */
			case 'D':   /* Delete last piece (toggle) */
				if(msg.hdr.attr&MSG_PERMANENT) {
					bputs("\r\nPermanent message.\r\n");
					domsg=0;
					break; }
				if(msg.total_hfields)
					smb_freemsgmem(&msg);
				msg.total_hfields=0;
				msg.idx.offset=0;
				if(smb_locksmbhdr(&smb)==SMB_SUCCESS) {	/* Lock the entire base */
					if(loadmsg(&msg,msg.idx.number)) {
						msg.hdr.attr^=MSG_DELETE;
						msg.idx.attr=msg.hdr.attr;
		//				  mail[smb.curmsg].attr=msg.hdr.attr;
						if((i=smb_putmsg(&smb,&msg))!=0)
							errormsg(WHERE,ERR_WRITE,smb.file,i);
						smb_unlockmsghdr(&smb,&msg); 
					}
					smb_unlocksmbhdr(&smb);
				}
				if(smb.curmsg<smb.msgs-1) smb.curmsg++;
				else done=1;
				break;
			case 'F':  /* Forward last piece */
				domsg=0;
				bputs(text[ForwardMailTo]);
				if(!getstr(str,LEN_ALIAS,cfg.uq&UQ_NOUPRLWR ? K_NONE:K_UPRLWR))
					break;
				i=finduser(str);
				if(!i)
					break;
				domsg=1;
				if(smb.curmsg<smb.msgs-1) smb.curmsg++;
				else done=1;
				smb_getmsgidx(&smb,&msg);
				forwardmail(&msg,i);
				if(msg.hdr.attr&MSG_PERMANENT)
					break;
				sprintf(str2,text[DeleteMailQ],msg.from);
				if(!yesno(str2))
					break;
				if(msg.total_hfields)
					smb_freemsgmem(&msg);
				msg.total_hfields=0;
				msg.idx.offset=0;
				if(smb_locksmbhdr(&smb)==SMB_SUCCESS) {	/* Lock the entire base */
					if(loadmsg(&msg,msg.idx.number)) {
						msg.hdr.attr|=MSG_DELETE;
						msg.idx.attr=msg.hdr.attr;
		//				  mail[smb.curmsg].attr=msg.hdr.attr;
						if((i=smb_putmsg(&smb,&msg))!=0)
							errormsg(WHERE,ERR_WRITE,smb.file,i);
						smb_unlockmsghdr(&smb,&msg); 
					}
					smb_unlocksmbhdr(&smb);
				}

				break;
			case 'H':
				domsg=0;
				msghdr(&msg);
				break;
			case 'L':     /* List mail */
				domsg=0;
				bprintf(text[StartWithN],(long)smb.curmsg+1);
				if((i=getnum(smb.msgs))>0)
					i--;
				else if(i==-1)
					break;
				else
					i=smb.curmsg;
				if(which==MAIL_SENT)
					bputs(text[MailSentLstHdr]);
				else if(which==MAIL_ALL)
					bputs(text[MailOnSystemLstHdr]);
				else
					bputs(text[MailWaitingLstHdr]);
				for(;i<smb.msgs && !msgabort();i++) {
					if(msg.total_hfields)
						smb_freemsgmem(&msg);
					msg.total_hfields=0;
					msg.idx.offset=mail[i].offset;
					if(!loadmsg(&msg,mail[i].number))
						continue;
					smb_unlockmsghdr(&smb,&msg);
					if(which==MAIL_ALL)
						bprintf(text[MailOnSystemLstFmt]
							,i+1,msg.from,msg.to
							,msg.hdr.attr&MSG_DELETE ? '-' : msg.hdr.attr&MSG_REPLIED ? 'R'
								: msg.hdr.attr&MSG_READ ? ' '
								: msg.from_net.type || msg.to_net.type ? 'N':'*'
							,msg.subj);
					else
						bprintf(text[MailWaitingLstFmt],i+1
							,which==MAIL_SENT ? msg.to
							: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
							? text[Anonymous] : msg.from
							,msg.hdr.attr&MSG_DELETE ? '-' : msg.hdr.attr&MSG_REPLIED ? 'R'
								: msg.hdr.attr&MSG_READ ? ' '
								: msg.from_net.type || msg.to_net.type ? 'N':'*'
							,msg.subj);
					smb_freemsgmem(&msg);
					msg.total_hfields=0; }
				break;
			case 'Q':
				done=1;
				break;
			case 'C':   /* Change attributes of last piece */
				i=chmsgattr(msg.hdr.attr);
				if(msg.hdr.attr==i)
					break;
				if(msg.total_hfields)
					smb_freemsgmem(&msg);
				msg.total_hfields=0;
				msg.idx.offset=0;
				if(smb_locksmbhdr(&smb)==SMB_SUCCESS) {	/* Lock the entire base */
					if(loadmsg(&msg,msg.idx.number)) {
						msg.hdr.attr=msg.idx.attr=(ushort)i;
						if((i=smb_putmsg(&smb,&msg))!=0)
							errormsg(WHERE,ERR_WRITE,smb.file,i);
						smb_unlockmsghdr(&smb,&msg); 
					}
					smb_unlocksmbhdr(&smb);
				}
				break;
			case '>':
				for(i=smb.curmsg+1;i<smb.msgs;i++)
					if(mail[i].subj==msg.idx.subj)
						break;
				if(i<smb.msgs)
					smb.curmsg=i;
				else
					domsg=0;
				break;
			case '<':   /* Search Title backward */
				for(i=smb.curmsg-1;i>-1;i--)
					if(mail[i].subj==msg.idx.subj)
						break;
				if(i>-1)
					smb.curmsg=i;
				else
					domsg=0;
				break;
			case '}':   /* Search Author forward */
				strcpy(str,msg.from);
				for(i=smb.curmsg+1;i<smb.msgs;i++)
					if(mail[i].from==msg.idx.from)
						break;
				if(i<smb.msgs)
					smb.curmsg=i;
				else
					domsg=0;
				break;
			case 'N':   /* Got to next un-read message */
				for(i=smb.curmsg+1;i<smb.msgs;i++)
					if(!(mail[i].attr&MSG_READ))
						break;
				if(i<smb.msgs)
					smb.curmsg=i;
				else
					domsg=0;
				break;
			case '{':   /* Search Author backward */
				strcpy(str,msg.from);
				for(i=smb.curmsg-1;i>-1;i--)
					if(mail[i].from==msg.idx.from)
						break;
				if(i>-1)
					smb.curmsg=i;
				else
					domsg=0;
				break;
			case ']':   /* Search To User forward */
				strcpy(str,msg.to);
				for(i=smb.curmsg+1;i<smb.msgs;i++)
					if(mail[i].to==msg.idx.to)
						break;
				if(i<smb.msgs)
					smb.curmsg=i;
				else
					domsg=0;
				break;
			case '[':   /* Search To User backward */
				strcpy(str,msg.to);
				for(i=smb.curmsg-1;i>-1;i--)
					if(mail[i].to==msg.idx.to)
						break;
				if(i>-1)
					smb.curmsg=i;
				else
					domsg=0;
				break;
			case 0:
			case '+':
				if(smb.curmsg<smb.msgs-1) smb.curmsg++;
				else done=1;
				break;
			case '-':
				if(smb.curmsg>0) smb.curmsg--;
				break;
			case 'S':
				domsg=0;
	/*
				if(!yesno(text[SaveMsgToFile]))
					break;
	*/
				bputs(text[FileToWriteTo]);
				if(getstr(str,40,K_LINE))
					msgtotxt(&msg,str,1,1);
				break;
			case 'E':
				editmsg(&msg,INVALID_SUB);
				break;
			case 'T':
				domsg=0;
				i=smb.curmsg;
				if(i) i++;
				j=i+10;
				if(j>smb.msgs)
					j=smb.msgs;

				if(which==MAIL_SENT)
					bputs(text[MailSentLstHdr]);
				else if(which==MAIL_ALL)
					bputs(text[MailOnSystemLstHdr]);
				else
					bputs(text[MailWaitingLstHdr]);
				for(;i<j;i++) {
					if(msg.total_hfields)
						smb_freemsgmem(&msg);
					msg.total_hfields=0;
					msg.idx.offset=mail[i].offset;
					if(!loadmsg(&msg,mail[i].number))
						continue;
					smb_unlockmsghdr(&smb,&msg);
					if(which==MAIL_ALL)
						bprintf(text[MailOnSystemLstFmt]
							,i+1,msg.from,msg.to
							,msg.hdr.attr&MSG_DELETE ? '-' : msg.hdr.attr&MSG_REPLIED ? 'R'
								: msg.hdr.attr&MSG_READ ? ' ' 
								: msg.from_net.type || msg.to_net.type ? 'N':'*'
							,msg.subj);
					else
						bprintf(text[MailWaitingLstFmt],i+1
							,which==MAIL_SENT ? msg.to
							: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
							? text[Anonymous] : msg.from
							,msg.hdr.attr&MSG_DELETE ? '-' : msg.hdr.attr&MSG_REPLIED ? 'R'
								: msg.hdr.attr&MSG_READ ? ' '
								: msg.from_net.type || msg.to_net.type ? 'N':'*'
							,msg.subj);
					smb_freemsgmem(&msg);
					msg.total_hfields=0; }
				smb.curmsg=(i-1);
				break;
			case 'U':   /* user edit */
				msg.hdr.number=msg.idx.number;
				smb_getmsgidx(&smb,&msg);
				useredit(which==MAIL_SENT ? msg.idx.to : msg.idx.from);
				break;
			case 'P':   /* Purge author and all mail to/from */
				if(noyes(text[AreYouSureQ]))
					break;
				msg.hdr.number=msg.idx.number;
				smb_getmsgidx(&smb,&msg);
				purgeuser(msg.idx.from);
				if(smb.curmsg<smb.msgs-1) smb.curmsg++;
				break;
			case '?':
				strcpy(str,which==MAIL_YOUR ? "mailread" : which==MAIL_ALL
						? "allmail" : "sentmail");
				menu(str);
				if(SYSOP && which==MAIL_SENT)
					menu("syssmail");
				else if(SYSOP && which==MAIL_YOUR)
					menu("sysmailr");   /* Sysop Mail Read */
				domsg=0;
				break;
				} }

	if(msg.total_hfields)
		smb_freemsgmem(&msg);

	if(smb.msgs)
		free(mail);

	/***************************************/
	/* Delete messages marked for deletion */
	/***************************************/

	if(cfg.sys_misc&SM_DELEMAIL) {
		if((i=smb_locksmbhdr(&smb))!=0) 			/* Lock the base, so nobody */
			errormsg(WHERE,ERR_LOCK,smb.file,i);	/* messes with the index */
		else
			delmail(usernumber,which); }

	smb_close(&smb);
	smb_stack(&smb,SMB_STACK_POP);
}
예제 #29
0
		bool UserPasswordRecoveryAction::sendPasswordRecoveryEMail(const User& user, const std::string sender) const 
		{
			/* Need a CMS in order to send a mail */
			if(!_cmsPasswordRecoveryEMail.get())
			{
				return false;
			}

			/* Build a mail and send it */
			try
			{
				EMail email(ServerModule::GetEMailSender());

				/* MIME type */
				string mimeType = _cmsPasswordRecoveryEMail.get()->getMimeType();
				if (mimeType == "text/html") {
					email.setFormat(EMail::EMAIL_HTML);
				}
				else
				{
					email.setFormat(EMail::EMAIL_TEXT);
				}

				/* Build header */
				email.setSender(sender);
				email.setSenderName(sender);

				stringstream subject;
				ParametersMap subjectMap;

				subjectMap.insert(DATA_SUBJECT_OR_CONTENT, TYPE_SUBJECT);

				_cmsPasswordRecoveryEMail.get()->display(subject, subjectMap);

				email.setSubject(subject.str());
				email.addRecipient(user.getEMail(), user.getName());

				/* Build content */
				stringstream content;
				ParametersMap contentMap;

				contentMap.insert(DATA_SUBJECT_OR_CONTENT, TYPE_CONTENT);
				contentMap.insert(DATA_USER_LOGIN, user.getLogin());
				contentMap.insert(DATA_USER_PASSWORD, user.getPassword());
				contentMap.insert(DATA_USER_EMAIL, user.getEMail());
				contentMap.insert(DATA_USER_PHONE, user.getPhone());
				contentMap.insert(DATA_USER_NAME, user.getName());
				contentMap.insert(DATA_USER_SURNAME, user.getSurname());

				_cmsPasswordRecoveryEMail.get()->display(content, contentMap);
				email.setContent(content.str());

				/* Send mail */
				email.send();

				return true;
			}
			catch(boost::system::system_error)
			{
				return false;
			}
		}
예제 #30
0
bool BazaarSettings::sameUserId(const BazaarSettings& other) const
{
    return userName() == other.userName() && email() == other.email();
}