Dropped email library system.
This commit is contained in:
parent
f607d155d5
commit
151665d044
@ -3,7 +3,6 @@
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="lib" path="dist/libs/c3p0-0.9.5.2.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/ecj-4.4.2.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/mail-1.5.2.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/mchange-commons-java-0.2.12.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/mysql-connector-java-5.1.43.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/netty-all-4.1.14.Final.jar"/>
|
||||
|
BIN
L2J_Mobius_Classic/dist/libs/mail-1.5.2.jar
vendored
BIN
L2J_Mobius_Classic/dist/libs/mail-1.5.2.jar
vendored
Binary file not shown.
65
L2J_Mobius_Classic/dist/login/config/Email.ini
vendored
65
L2J_Mobius_Classic/dist/login/config/Email.ini
vendored
@ -1,65 +0,0 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# Email Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
# The defaults are set to be retail-like. If you modify any of these settings your server will deviate from being retail-like.
|
||||
# Warning:
|
||||
# Please take extreme caution when changing anything. Also please understand what you are changing before you do so on a live server.
|
||||
# ---------------------------------------------------------------------------
|
||||
# Server Information
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Server Name
|
||||
# Default: Unconfigured Server
|
||||
ServerInfoName = Unconfigured Server
|
||||
|
||||
# Contact Address
|
||||
# Default: info@unconfl2j.com
|
||||
ServerInfoAddress = info@myl2jserver.com
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# E-mail System Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable Email System
|
||||
# Default: False
|
||||
EmailSystemEnabled = False
|
||||
|
||||
# Select Query for Email Addresses
|
||||
# Default: SELECT value FROM account_data WHERE account_name=? AND var='email_addr'
|
||||
EmailDBSelectQuery = SELECT value FROM account_data WHERE account_name=? AND var='email_addr'
|
||||
|
||||
# Email Address Field
|
||||
# Default: value
|
||||
EmailDBField = value
|
||||
|
||||
# Mail Server Host
|
||||
# Default: smtp.gmail.com
|
||||
SmtpServerHost = smtp.gmail.com
|
||||
|
||||
# Mail Server Port
|
||||
# Default: 465
|
||||
SmtpServerPort = 465
|
||||
|
||||
# Auth SMTP
|
||||
# Default: True
|
||||
SmtpAuthRequired = True
|
||||
|
||||
# Mail Socket Factory
|
||||
# Default: javax.net.ssl.SSLSocketFactory
|
||||
SmtpFactory = javax.net.ssl.SSLSocketFactory
|
||||
|
||||
# Mail Factory Callback
|
||||
# Default: False
|
||||
SmtpFactoryCallback = False
|
||||
|
||||
# Mail Server Auth - Username
|
||||
# Default: exampleuser
|
||||
SmtpUsername = user@gmail.com
|
||||
|
||||
# Mail Server Auth - Password
|
||||
# Default: examplepass
|
||||
SmtpPassword = password
|
||||
|
||||
# Mail Address
|
||||
# Default: None
|
||||
EmailSystemAddress = noreply@myl2jserver.com
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MailList.xsd">
|
||||
<mail id="SATempBan" file="html/SecAuthTempBan.htm" subject="Your account has been temporarily suspended" />
|
||||
</list>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<element name="list">
|
||||
<complexType>
|
||||
<sequence minOccurs="1" maxOccurs="1">
|
||||
<element name="mail" minOccurs="1" maxOccurs="1">
|
||||
<complexType>
|
||||
<attribute name="file" type="token" use="required" />
|
||||
<attribute name="id" type="token" use="required" />
|
||||
<attribute name="subject" type="normalizedString" use="required" />
|
||||
</complexType>
|
||||
</element>
|
||||
</sequence>
|
||||
</complexType>
|
||||
</element>
|
||||
</schema>
|
@ -1,13 +0,0 @@
|
||||
Greetings,<br>
|
||||
<br>
|
||||
We have temporally suspended your account:<br>
|
||||
<br>
|
||||
Account Name: %accountname%<br>
|
||||
Reason: Typed wrong character password %var1% times in row from ip %var0%.<br>
|
||||
Consequences: Your account has been temporaly suspended for %var2% minutes.<br>
|
||||
<br>
|
||||
If you've lost your your character password, you can recover them by <a href="%var3%">clicking here</a>.<br>
|
||||
<br>
|
||||
If you have any question, <a href="mailto:%servermail%">click here</a> to send an email to the administrator.<br>
|
||||
Regards,<br>
|
||||
%servername% Game Master Team
|
@ -103,7 +103,6 @@ public final class Config
|
||||
public static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
public static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
public static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
public static final String EMAIL_CONFIG_FILE = "./config/Email.ini";
|
||||
public static final String CH_SIEGE_FILE = "./config/ConquerableHallSiege.ini";
|
||||
public static final String GEODATA_FILE = "./config/GeoData.ini";
|
||||
|
||||
@ -921,21 +920,6 @@ public final class Config
|
||||
// chatfilter
|
||||
public static List<String> FILTER_LIST;
|
||||
|
||||
// Email
|
||||
public static String EMAIL_SERVERINFO_NAME;
|
||||
public static String EMAIL_SERVERINFO_ADDRESS;
|
||||
public static boolean EMAIL_SYS_ENABLED;
|
||||
public static String EMAIL_SYS_HOST;
|
||||
public static int EMAIL_SYS_PORT;
|
||||
public static boolean EMAIL_SYS_SMTP_AUTH;
|
||||
public static String EMAIL_SYS_FACTORY;
|
||||
public static boolean EMAIL_SYS_FACTORY_CALLBACK;
|
||||
public static String EMAIL_SYS_USERNAME;
|
||||
public static String EMAIL_SYS_PASSWORD;
|
||||
public static String EMAIL_SYS_ADDRESS;
|
||||
public static String EMAIL_SYS_SELECTQUERY;
|
||||
public static String EMAIL_SYS_DBFIELD;
|
||||
|
||||
// Conquerable Halls Settings
|
||||
public static int CHS_CLAN_MINLEVEL;
|
||||
public static int CHS_MAX_ATTACKERS;
|
||||
@ -2773,24 +2757,6 @@ public final class Config
|
||||
MMO_MAX_READ_PER_PASS = mmoSettings.getInt("MaxReadPerPass", 12);
|
||||
MMO_HELPER_BUFFER_COUNT = mmoSettings.getInt("HelperBufferCount", 20);
|
||||
MMO_TCP_NODELAY = mmoSettings.getBoolean("TcpNoDelay", false);
|
||||
|
||||
// Email
|
||||
final PropertiesParser emailSettings = new PropertiesParser(EMAIL_CONFIG_FILE);
|
||||
|
||||
EMAIL_SERVERINFO_NAME = emailSettings.getString("ServerInfoName", "Unconfigured Server");
|
||||
EMAIL_SERVERINFO_ADDRESS = emailSettings.getString("ServerInfoAddress", "info@myl2jserver.com");
|
||||
|
||||
EMAIL_SYS_ENABLED = emailSettings.getBoolean("EmailSystemEnabled", false);
|
||||
EMAIL_SYS_HOST = emailSettings.getString("SmtpServerHost", "smtp.gmail.com");
|
||||
EMAIL_SYS_PORT = emailSettings.getInt("SmtpServerPort", 465);
|
||||
EMAIL_SYS_SMTP_AUTH = emailSettings.getBoolean("SmtpAuthRequired", true);
|
||||
EMAIL_SYS_FACTORY = emailSettings.getString("SmtpFactory", "javax.net.ssl.SSLSocketFactory");
|
||||
EMAIL_SYS_FACTORY_CALLBACK = emailSettings.getBoolean("SmtpFactoryCallback", false);
|
||||
EMAIL_SYS_USERNAME = emailSettings.getString("SmtpUsername", "user@gmail.com");
|
||||
EMAIL_SYS_PASSWORD = emailSettings.getString("SmtpPassword", "password");
|
||||
EMAIL_SYS_ADDRESS = emailSettings.getString("EmailSystemAddress", "noreply@myl2jserver.com");
|
||||
EMAIL_SYS_SELECTQUERY = emailSettings.getString("EmailDBSelectQuery", "SELECT value FROM account_data WHERE account_name=? AND var='email_addr'");
|
||||
EMAIL_SYS_DBFIELD = emailSettings.getString("EmailDBField", "value");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -32,7 +32,6 @@ import java.util.logging.Logger;
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.Server;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.loginserver.mail.MailSystem;
|
||||
import com.l2jmobius.loginserver.network.L2LoginClient;
|
||||
import com.l2jmobius.loginserver.network.L2LoginPacketHandler;
|
||||
import com.l2jmobius.loginserver.network.mmocore.SelectorConfig;
|
||||
@ -106,11 +105,6 @@ public final class L2LoginServer
|
||||
|
||||
loadBanFile();
|
||||
|
||||
if (Config.EMAIL_SYS_ENABLED)
|
||||
{
|
||||
MailSystem.getInstance();
|
||||
}
|
||||
|
||||
InetAddress bindAddress = null;
|
||||
if (!Config.LOGIN_BIND_ADDRESS.equals("*"))
|
||||
{
|
||||
|
@ -1,162 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.loginserver.mail;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.mail.Authenticator;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.PasswordAuthentication;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.Transport;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.loginserver.mail.MailSystem.MailContent;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class BaseMail implements Runnable
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(BaseMail.class.getName());
|
||||
|
||||
private MimeMessage _messageMime = null;
|
||||
|
||||
private class SmtpAuthenticator extends Authenticator
|
||||
{
|
||||
private final PasswordAuthentication _auth;
|
||||
|
||||
public SmtpAuthenticator()
|
||||
{
|
||||
_auth = new PasswordAuthentication(Config.EMAIL_SYS_USERNAME, Config.EMAIL_SYS_PASSWORD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PasswordAuthentication getPasswordAuthentication()
|
||||
{
|
||||
return _auth;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseMail(String account, String mailId, String... args)
|
||||
{
|
||||
final String mailAddr = getUserMail(account);
|
||||
|
||||
if (mailAddr == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final MailContent content = MailSystem.getInstance().getMailContent(mailId);
|
||||
if (content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String message = compileHtml(account, content.getText(), args);
|
||||
|
||||
final Properties mailProp = new Properties();
|
||||
mailProp.put("mail.smtp.host", Config.EMAIL_SYS_HOST);
|
||||
mailProp.put("mail.smtp.auth", Config.EMAIL_SYS_SMTP_AUTH);
|
||||
mailProp.put("mail.smtp.port", Config.EMAIL_SYS_PORT);
|
||||
mailProp.put("mail.smtp.socketFactory.port", Config.EMAIL_SYS_PORT);
|
||||
mailProp.put("mail.smtp.socketFactory.class", Config.EMAIL_SYS_FACTORY);
|
||||
mailProp.put("mail.smtp.socketFactory.fallback", Config.EMAIL_SYS_FACTORY_CALLBACK);
|
||||
final SmtpAuthenticator authenticator = (Config.EMAIL_SYS_SMTP_AUTH ? new SmtpAuthenticator() : null);
|
||||
|
||||
final Session mailSession = Session.getDefaultInstance(mailProp, authenticator);
|
||||
|
||||
try
|
||||
{
|
||||
_messageMime = new MimeMessage(mailSession);
|
||||
_messageMime.setSubject(content.getSubject());
|
||||
try
|
||||
{
|
||||
_messageMime.setFrom(new InternetAddress(Config.EMAIL_SYS_ADDRESS, Config.EMAIL_SERVERINFO_NAME));
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
_log.warning("Sender Address not Valid!");
|
||||
}
|
||||
_messageMime.setContent(message, "text/html");
|
||||
_messageMime.setRecipient(Message.RecipientType.TO, new InternetAddress(mailAddr));
|
||||
}
|
||||
catch (MessagingException e)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private String compileHtml(String account, String html, String[] args)
|
||||
{
|
||||
if (args != null)
|
||||
{
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
html = html.replace("%var" + i + "%", args[i]);
|
||||
}
|
||||
}
|
||||
html = html.replace("%accountname%", account);
|
||||
return html;
|
||||
}
|
||||
|
||||
private String getUserMail(String username)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(Config.EMAIL_SYS_SELECTQUERY))
|
||||
{
|
||||
statement.setString(1, username);
|
||||
try (ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
if (rset.next())
|
||||
{
|
||||
return rset.getString(Config.EMAIL_SYS_DBFIELD);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Cannot select user mail: Exception");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_messageMime != null)
|
||||
{
|
||||
Transport.send(_messageMime);
|
||||
}
|
||||
}
|
||||
catch (MessagingException e)
|
||||
{
|
||||
_log.warning("Error encounterd while sending email");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,152 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.loginserver.mail;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class MailSystem
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(MailSystem.class.getName());
|
||||
private final Map<String, MailContent> _mailData = new ConcurrentHashMap<>();
|
||||
|
||||
public static MailSystem getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
public MailSystem()
|
||||
{
|
||||
loadMails();
|
||||
}
|
||||
|
||||
public void sendMail(String account, String messageId, String... args)
|
||||
{
|
||||
final BaseMail mail = new BaseMail(account, messageId, args);
|
||||
mail.run();
|
||||
}
|
||||
|
||||
private void loadMails()
|
||||
{
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setValidating(false);
|
||||
factory.setIgnoringComments(true);
|
||||
final File file = new File(Config.DATAPACK_ROOT, "data/mail/MailList.xml");
|
||||
Document doc = null;
|
||||
if (file.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
doc = factory.newDocumentBuilder().parse(file);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Could not parse MailList.xml file: " + e.getMessage(), e);
|
||||
return;
|
||||
}
|
||||
|
||||
final Node n = doc.getFirstChild();
|
||||
File mailFile;
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
if (d.getNodeName().equals("mail"))
|
||||
{
|
||||
final String mailId = d.getAttributes().getNamedItem("id").getNodeValue();
|
||||
final String subject = d.getAttributes().getNamedItem("subject").getNodeValue();
|
||||
final String maFile = d.getAttributes().getNamedItem("file").getNodeValue();
|
||||
|
||||
mailFile = new File(Config.DATAPACK_ROOT, "data/mail/" + maFile);
|
||||
try (FileInputStream fis = new FileInputStream(mailFile);
|
||||
BufferedInputStream bis = new BufferedInputStream(fis))
|
||||
{
|
||||
final int bytes = bis.available();
|
||||
final byte[] raw = new byte[bytes];
|
||||
|
||||
bis.read(raw);
|
||||
String html = new String(raw, "UTF-8");
|
||||
html = html.replaceAll(Config.EOL, "\n");
|
||||
html = html.replace("%servermail%", Config.EMAIL_SERVERINFO_ADDRESS);
|
||||
html = html.replace("%servername%", Config.EMAIL_SERVERINFO_NAME);
|
||||
|
||||
_mailData.put(mailId, new MailContent(subject, html));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
_log.warning("IOException while reading " + maFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
_log.info("eMail System Loaded");
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("Cannot load eMail System - Missing file MailList.xml");
|
||||
}
|
||||
}
|
||||
|
||||
public class MailContent
|
||||
{
|
||||
private final String _subject;
|
||||
private final String _text;
|
||||
|
||||
/**
|
||||
* @param subject
|
||||
* @param text
|
||||
*/
|
||||
public MailContent(String subject, String text)
|
||||
{
|
||||
_subject = subject;
|
||||
_text = text;
|
||||
}
|
||||
|
||||
public String getSubject()
|
||||
{
|
||||
return _subject;
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
}
|
||||
|
||||
public MailContent getMailContent(String mailId)
|
||||
{
|
||||
return _mailData.get(mailId);
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final MailSystem _instance = new MailSystem();
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ package com.l2jmobius.loginserver.network;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.network.BaseRecievePacket;
|
||||
import com.l2jmobius.loginserver.GameServerThread;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.BlowFishKey;
|
||||
@ -30,7 +29,6 @@ import com.l2jmobius.loginserver.network.gameserverpackets.PlayerInGame;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.PlayerLogout;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.PlayerTracert;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.ReplyCharacters;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.RequestSendMail;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.RequestTempBan;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.ServerStatus;
|
||||
import com.l2jmobius.loginserver.network.loginserverpackets.LoginServerFail;
|
||||
@ -105,10 +103,7 @@ public class L2JGameServerPacketHandler
|
||||
msg = new ReplyCharacters(data, server);
|
||||
break;
|
||||
case 0x09:
|
||||
if (Config.EMAIL_SYS_ENABLED)
|
||||
{
|
||||
msg = new RequestSendMail(data);
|
||||
}
|
||||
// msg = new RequestSendMail(data);
|
||||
break;
|
||||
case 0x0A:
|
||||
msg = new RequestTempBan(data);
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.loginserver.network.gameserverpackets;
|
||||
|
||||
import com.l2jmobius.commons.util.network.BaseRecievePacket;
|
||||
import com.l2jmobius.loginserver.mail.MailSystem;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class RequestSendMail extends BaseRecievePacket
|
||||
{
|
||||
String _accountName, _mailId;
|
||||
String[] _args;
|
||||
|
||||
/**
|
||||
* @param decrypt
|
||||
*/
|
||||
public RequestSendMail(byte[] decrypt)
|
||||
{
|
||||
super(decrypt);
|
||||
_accountName = readS();
|
||||
_mailId = readS();
|
||||
final int argNum = readC();
|
||||
_args = new String[argNum];
|
||||
for (int i = 0; i < argNum; i++)
|
||||
{
|
||||
_args[i] = readS();
|
||||
}
|
||||
|
||||
MailSystem.getInstance().sendMail(_accountName, _mailId, _args);
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/mail-1.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
</listAttribute>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/mail-1.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Classic/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
</listAttribute>
|
||||
|
@ -3,7 +3,6 @@
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="lib" path="dist/libs/c3p0-0.9.5.2.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/ecj-4.4.2.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/mail-1.5.2.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/mchange-commons-java-0.2.12.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/mysql-connector-java-5.1.43.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/netty-all-4.1.14.Final.jar"/>
|
||||
|
BIN
L2J_Mobius_Helios/dist/libs/mail-1.5.2.jar
vendored
BIN
L2J_Mobius_Helios/dist/libs/mail-1.5.2.jar
vendored
Binary file not shown.
65
L2J_Mobius_Helios/dist/login/config/Email.ini
vendored
65
L2J_Mobius_Helios/dist/login/config/Email.ini
vendored
@ -1,65 +0,0 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# Email Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
# The defaults are set to be retail-like. If you modify any of these settings your server will deviate from being retail-like.
|
||||
# Warning:
|
||||
# Please take extreme caution when changing anything. Also please understand what you are changing before you do so on a live server.
|
||||
# ---------------------------------------------------------------------------
|
||||
# Server Information
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Server Name
|
||||
# Default: Unconfigured Server
|
||||
ServerInfoName = Unconfigured Server
|
||||
|
||||
# Contact Address
|
||||
# Default: info@unconfl2j.com
|
||||
ServerInfoAddress = info@myl2jserver.com
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# E-mail System Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable Email System
|
||||
# Default: False
|
||||
EmailSystemEnabled = False
|
||||
|
||||
# Select Query for Email Addresses
|
||||
# Default: SELECT value FROM account_data WHERE account_name=? AND var='email_addr'
|
||||
EmailDBSelectQuery = SELECT value FROM account_data WHERE account_name=? AND var='email_addr'
|
||||
|
||||
# Email Address Field
|
||||
# Default: value
|
||||
EmailDBField = value
|
||||
|
||||
# Mail Server Host
|
||||
# Default: smtp.gmail.com
|
||||
SmtpServerHost = smtp.gmail.com
|
||||
|
||||
# Mail Server Port
|
||||
# Default: 465
|
||||
SmtpServerPort = 465
|
||||
|
||||
# Auth SMTP
|
||||
# Default: True
|
||||
SmtpAuthRequired = True
|
||||
|
||||
# Mail Socket Factory
|
||||
# Default: javax.net.ssl.SSLSocketFactory
|
||||
SmtpFactory = javax.net.ssl.SSLSocketFactory
|
||||
|
||||
# Mail Factory Callback
|
||||
# Default: False
|
||||
SmtpFactoryCallback = False
|
||||
|
||||
# Mail Server Auth - Username
|
||||
# Default: exampleuser
|
||||
SmtpUsername = user@gmail.com
|
||||
|
||||
# Mail Server Auth - Password
|
||||
# Default: examplepass
|
||||
SmtpPassword = password
|
||||
|
||||
# Mail Address
|
||||
# Default: None
|
||||
EmailSystemAddress = noreply@myl2jserver.com
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MailList.xsd">
|
||||
<mail id="SATempBan" file="html/SecAuthTempBan.htm" subject="Your account has been temporarily suspended" />
|
||||
</list>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<element name="list">
|
||||
<complexType>
|
||||
<sequence minOccurs="1" maxOccurs="1">
|
||||
<element name="mail" minOccurs="1" maxOccurs="1">
|
||||
<complexType>
|
||||
<attribute name="file" type="token" use="required" />
|
||||
<attribute name="id" type="token" use="required" />
|
||||
<attribute name="subject" type="normalizedString" use="required" />
|
||||
</complexType>
|
||||
</element>
|
||||
</sequence>
|
||||
</complexType>
|
||||
</element>
|
||||
</schema>
|
@ -1,13 +0,0 @@
|
||||
Greetings,<br>
|
||||
<br>
|
||||
We have temporally suspended your account:<br>
|
||||
<br>
|
||||
Account Name: %accountname%<br>
|
||||
Reason: Typed wrong character password %var1% times in row from ip %var0%.<br>
|
||||
Consequences: Your account has been temporaly suspended for %var2% minutes.<br>
|
||||
<br>
|
||||
If you've lost your your character password, you can recover them by <a href="%var3%">clicking here</a>.<br>
|
||||
<br>
|
||||
If you have any question, <a href="mailto:%servermail%">click here</a> to send an email to the administrator.<br>
|
||||
Regards,<br>
|
||||
%servername% Game Master Team
|
@ -103,7 +103,6 @@ public final class Config
|
||||
public static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
public static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
public static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
public static final String EMAIL_CONFIG_FILE = "./config/Email.ini";
|
||||
public static final String CH_SIEGE_FILE = "./config/ConquerableHallSiege.ini";
|
||||
public static final String GEODATA_FILE = "./config/GeoData.ini";
|
||||
|
||||
@ -920,21 +919,6 @@ public final class Config
|
||||
// chatfilter
|
||||
public static List<String> FILTER_LIST;
|
||||
|
||||
// Email
|
||||
public static String EMAIL_SERVERINFO_NAME;
|
||||
public static String EMAIL_SERVERINFO_ADDRESS;
|
||||
public static boolean EMAIL_SYS_ENABLED;
|
||||
public static String EMAIL_SYS_HOST;
|
||||
public static int EMAIL_SYS_PORT;
|
||||
public static boolean EMAIL_SYS_SMTP_AUTH;
|
||||
public static String EMAIL_SYS_FACTORY;
|
||||
public static boolean EMAIL_SYS_FACTORY_CALLBACK;
|
||||
public static String EMAIL_SYS_USERNAME;
|
||||
public static String EMAIL_SYS_PASSWORD;
|
||||
public static String EMAIL_SYS_ADDRESS;
|
||||
public static String EMAIL_SYS_SELECTQUERY;
|
||||
public static String EMAIL_SYS_DBFIELD;
|
||||
|
||||
// Conquerable Halls Settings
|
||||
public static int CHS_CLAN_MINLEVEL;
|
||||
public static int CHS_MAX_ATTACKERS;
|
||||
@ -2771,24 +2755,6 @@ public final class Config
|
||||
MMO_MAX_READ_PER_PASS = mmoSettings.getInt("MaxReadPerPass", 12);
|
||||
MMO_HELPER_BUFFER_COUNT = mmoSettings.getInt("HelperBufferCount", 20);
|
||||
MMO_TCP_NODELAY = mmoSettings.getBoolean("TcpNoDelay", false);
|
||||
|
||||
// Email
|
||||
final PropertiesParser emailSettings = new PropertiesParser(EMAIL_CONFIG_FILE);
|
||||
|
||||
EMAIL_SERVERINFO_NAME = emailSettings.getString("ServerInfoName", "Unconfigured Server");
|
||||
EMAIL_SERVERINFO_ADDRESS = emailSettings.getString("ServerInfoAddress", "info@myl2jserver.com");
|
||||
|
||||
EMAIL_SYS_ENABLED = emailSettings.getBoolean("EmailSystemEnabled", false);
|
||||
EMAIL_SYS_HOST = emailSettings.getString("SmtpServerHost", "smtp.gmail.com");
|
||||
EMAIL_SYS_PORT = emailSettings.getInt("SmtpServerPort", 465);
|
||||
EMAIL_SYS_SMTP_AUTH = emailSettings.getBoolean("SmtpAuthRequired", true);
|
||||
EMAIL_SYS_FACTORY = emailSettings.getString("SmtpFactory", "javax.net.ssl.SSLSocketFactory");
|
||||
EMAIL_SYS_FACTORY_CALLBACK = emailSettings.getBoolean("SmtpFactoryCallback", false);
|
||||
EMAIL_SYS_USERNAME = emailSettings.getString("SmtpUsername", "user@gmail.com");
|
||||
EMAIL_SYS_PASSWORD = emailSettings.getString("SmtpPassword", "password");
|
||||
EMAIL_SYS_ADDRESS = emailSettings.getString("EmailSystemAddress", "noreply@myl2jserver.com");
|
||||
EMAIL_SYS_SELECTQUERY = emailSettings.getString("EmailDBSelectQuery", "SELECT value FROM account_data WHERE account_name=? AND var='email_addr'");
|
||||
EMAIL_SYS_DBFIELD = emailSettings.getString("EmailDBField", "value");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -32,7 +32,6 @@ import java.util.logging.Logger;
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.Server;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.loginserver.mail.MailSystem;
|
||||
import com.l2jmobius.loginserver.network.L2LoginClient;
|
||||
import com.l2jmobius.loginserver.network.L2LoginPacketHandler;
|
||||
import com.l2jmobius.loginserver.network.mmocore.SelectorConfig;
|
||||
@ -106,11 +105,6 @@ public final class L2LoginServer
|
||||
|
||||
loadBanFile();
|
||||
|
||||
if (Config.EMAIL_SYS_ENABLED)
|
||||
{
|
||||
MailSystem.getInstance();
|
||||
}
|
||||
|
||||
InetAddress bindAddress = null;
|
||||
if (!Config.LOGIN_BIND_ADDRESS.equals("*"))
|
||||
{
|
||||
|
@ -1,162 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.loginserver.mail;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.mail.Authenticator;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.PasswordAuthentication;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.Transport;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.loginserver.mail.MailSystem.MailContent;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class BaseMail implements Runnable
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(BaseMail.class.getName());
|
||||
|
||||
private MimeMessage _messageMime = null;
|
||||
|
||||
private class SmtpAuthenticator extends Authenticator
|
||||
{
|
||||
private final PasswordAuthentication _auth;
|
||||
|
||||
public SmtpAuthenticator()
|
||||
{
|
||||
_auth = new PasswordAuthentication(Config.EMAIL_SYS_USERNAME, Config.EMAIL_SYS_PASSWORD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PasswordAuthentication getPasswordAuthentication()
|
||||
{
|
||||
return _auth;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseMail(String account, String mailId, String... args)
|
||||
{
|
||||
final String mailAddr = getUserMail(account);
|
||||
|
||||
if (mailAddr == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final MailContent content = MailSystem.getInstance().getMailContent(mailId);
|
||||
if (content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String message = compileHtml(account, content.getText(), args);
|
||||
|
||||
final Properties mailProp = new Properties();
|
||||
mailProp.put("mail.smtp.host", Config.EMAIL_SYS_HOST);
|
||||
mailProp.put("mail.smtp.auth", Config.EMAIL_SYS_SMTP_AUTH);
|
||||
mailProp.put("mail.smtp.port", Config.EMAIL_SYS_PORT);
|
||||
mailProp.put("mail.smtp.socketFactory.port", Config.EMAIL_SYS_PORT);
|
||||
mailProp.put("mail.smtp.socketFactory.class", Config.EMAIL_SYS_FACTORY);
|
||||
mailProp.put("mail.smtp.socketFactory.fallback", Config.EMAIL_SYS_FACTORY_CALLBACK);
|
||||
final SmtpAuthenticator authenticator = (Config.EMAIL_SYS_SMTP_AUTH ? new SmtpAuthenticator() : null);
|
||||
|
||||
final Session mailSession = Session.getDefaultInstance(mailProp, authenticator);
|
||||
|
||||
try
|
||||
{
|
||||
_messageMime = new MimeMessage(mailSession);
|
||||
_messageMime.setSubject(content.getSubject());
|
||||
try
|
||||
{
|
||||
_messageMime.setFrom(new InternetAddress(Config.EMAIL_SYS_ADDRESS, Config.EMAIL_SERVERINFO_NAME));
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
_log.warning("Sender Address not Valid!");
|
||||
}
|
||||
_messageMime.setContent(message, "text/html");
|
||||
_messageMime.setRecipient(Message.RecipientType.TO, new InternetAddress(mailAddr));
|
||||
}
|
||||
catch (MessagingException e)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private String compileHtml(String account, String html, String[] args)
|
||||
{
|
||||
if (args != null)
|
||||
{
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
html = html.replace("%var" + i + "%", args[i]);
|
||||
}
|
||||
}
|
||||
html = html.replace("%accountname%", account);
|
||||
return html;
|
||||
}
|
||||
|
||||
private String getUserMail(String username)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(Config.EMAIL_SYS_SELECTQUERY))
|
||||
{
|
||||
statement.setString(1, username);
|
||||
try (ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
if (rset.next())
|
||||
{
|
||||
return rset.getString(Config.EMAIL_SYS_DBFIELD);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Cannot select user mail: Exception");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_messageMime != null)
|
||||
{
|
||||
Transport.send(_messageMime);
|
||||
}
|
||||
}
|
||||
catch (MessagingException e)
|
||||
{
|
||||
_log.warning("Error encounterd while sending email");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,152 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.loginserver.mail;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class MailSystem
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(MailSystem.class.getName());
|
||||
private final Map<String, MailContent> _mailData = new ConcurrentHashMap<>();
|
||||
|
||||
public static MailSystem getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
public MailSystem()
|
||||
{
|
||||
loadMails();
|
||||
}
|
||||
|
||||
public void sendMail(String account, String messageId, String... args)
|
||||
{
|
||||
final BaseMail mail = new BaseMail(account, messageId, args);
|
||||
mail.run();
|
||||
}
|
||||
|
||||
private void loadMails()
|
||||
{
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setValidating(false);
|
||||
factory.setIgnoringComments(true);
|
||||
final File file = new File(Config.DATAPACK_ROOT, "data/mail/MailList.xml");
|
||||
Document doc = null;
|
||||
if (file.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
doc = factory.newDocumentBuilder().parse(file);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Could not parse MailList.xml file: " + e.getMessage(), e);
|
||||
return;
|
||||
}
|
||||
|
||||
final Node n = doc.getFirstChild();
|
||||
File mailFile;
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
if (d.getNodeName().equals("mail"))
|
||||
{
|
||||
final String mailId = d.getAttributes().getNamedItem("id").getNodeValue();
|
||||
final String subject = d.getAttributes().getNamedItem("subject").getNodeValue();
|
||||
final String maFile = d.getAttributes().getNamedItem("file").getNodeValue();
|
||||
|
||||
mailFile = new File(Config.DATAPACK_ROOT, "data/mail/" + maFile);
|
||||
try (FileInputStream fis = new FileInputStream(mailFile);
|
||||
BufferedInputStream bis = new BufferedInputStream(fis))
|
||||
{
|
||||
final int bytes = bis.available();
|
||||
final byte[] raw = new byte[bytes];
|
||||
|
||||
bis.read(raw);
|
||||
String html = new String(raw, "UTF-8");
|
||||
html = html.replaceAll(Config.EOL, "\n");
|
||||
html = html.replace("%servermail%", Config.EMAIL_SERVERINFO_ADDRESS);
|
||||
html = html.replace("%servername%", Config.EMAIL_SERVERINFO_NAME);
|
||||
|
||||
_mailData.put(mailId, new MailContent(subject, html));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
_log.warning("IOException while reading " + maFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
_log.info("eMail System Loaded");
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("Cannot load eMail System - Missing file MailList.xml");
|
||||
}
|
||||
}
|
||||
|
||||
public class MailContent
|
||||
{
|
||||
private final String _subject;
|
||||
private final String _text;
|
||||
|
||||
/**
|
||||
* @param subject
|
||||
* @param text
|
||||
*/
|
||||
public MailContent(String subject, String text)
|
||||
{
|
||||
_subject = subject;
|
||||
_text = text;
|
||||
}
|
||||
|
||||
public String getSubject()
|
||||
{
|
||||
return _subject;
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
}
|
||||
|
||||
public MailContent getMailContent(String mailId)
|
||||
{
|
||||
return _mailData.get(mailId);
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final MailSystem _instance = new MailSystem();
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ package com.l2jmobius.loginserver.network;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.network.BaseRecievePacket;
|
||||
import com.l2jmobius.loginserver.GameServerThread;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.BlowFishKey;
|
||||
@ -30,7 +29,6 @@ import com.l2jmobius.loginserver.network.gameserverpackets.PlayerInGame;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.PlayerLogout;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.PlayerTracert;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.ReplyCharacters;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.RequestSendMail;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.RequestTempBan;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.ServerStatus;
|
||||
import com.l2jmobius.loginserver.network.loginserverpackets.LoginServerFail;
|
||||
@ -105,10 +103,7 @@ public class L2JGameServerPacketHandler
|
||||
msg = new ReplyCharacters(data, server);
|
||||
break;
|
||||
case 0x09:
|
||||
if (Config.EMAIL_SYS_ENABLED)
|
||||
{
|
||||
msg = new RequestSendMail(data);
|
||||
}
|
||||
// msg = new RequestSendMail(data);
|
||||
break;
|
||||
case 0x0A:
|
||||
msg = new RequestTempBan(data);
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.loginserver.network.gameserverpackets;
|
||||
|
||||
import com.l2jmobius.commons.util.network.BaseRecievePacket;
|
||||
import com.l2jmobius.loginserver.mail.MailSystem;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class RequestSendMail extends BaseRecievePacket
|
||||
{
|
||||
String _accountName, _mailId;
|
||||
String[] _args;
|
||||
|
||||
/**
|
||||
* @param decrypt
|
||||
*/
|
||||
public RequestSendMail(byte[] decrypt)
|
||||
{
|
||||
super(decrypt);
|
||||
_accountName = readS();
|
||||
_mailId = readS();
|
||||
final int argNum = readC();
|
||||
_args = new String[argNum];
|
||||
for (int i = 0; i < argNum; i++)
|
||||
{
|
||||
_args[i] = readS();
|
||||
}
|
||||
|
||||
MailSystem.getInstance().sendMail(_accountName, _mailId, _args);
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/mail-1.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
</listAttribute>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/mail-1.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Helios/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
</listAttribute>
|
||||
|
@ -3,7 +3,6 @@
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="lib" path="dist/libs/c3p0-0.9.5.2.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/ecj-4.4.2.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/mail-1.5.2.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/mchange-commons-java-0.2.12.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/mysql-connector-java-5.1.43.jar"/>
|
||||
<classpathentry kind="lib" path="dist/libs/netty-all-4.1.14.Final.jar"/>
|
||||
|
BIN
L2J_Mobius_Underground/dist/libs/mail-1.5.2.jar
vendored
BIN
L2J_Mobius_Underground/dist/libs/mail-1.5.2.jar
vendored
Binary file not shown.
@ -1,65 +0,0 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# Email Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
# The defaults are set to be retail-like. If you modify any of these settings your server will deviate from being retail-like.
|
||||
# Warning:
|
||||
# Please take extreme caution when changing anything. Also please understand what you are changing before you do so on a live server.
|
||||
# ---------------------------------------------------------------------------
|
||||
# Server Information
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Server Name
|
||||
# Default: Unconfigured Server
|
||||
ServerInfoName = Unconfigured Server
|
||||
|
||||
# Contact Address
|
||||
# Default: info@unconfl2j.com
|
||||
ServerInfoAddress = info@myl2jserver.com
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# E-mail System Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable Email System
|
||||
# Default: False
|
||||
EmailSystemEnabled = False
|
||||
|
||||
# Select Query for Email Addresses
|
||||
# Default: SELECT value FROM account_data WHERE account_name=? AND var='email_addr'
|
||||
EmailDBSelectQuery = SELECT value FROM account_data WHERE account_name=? AND var='email_addr'
|
||||
|
||||
# Email Address Field
|
||||
# Default: value
|
||||
EmailDBField = value
|
||||
|
||||
# Mail Server Host
|
||||
# Default: smtp.gmail.com
|
||||
SmtpServerHost = smtp.gmail.com
|
||||
|
||||
# Mail Server Port
|
||||
# Default: 465
|
||||
SmtpServerPort = 465
|
||||
|
||||
# Auth SMTP
|
||||
# Default: True
|
||||
SmtpAuthRequired = True
|
||||
|
||||
# Mail Socket Factory
|
||||
# Default: javax.net.ssl.SSLSocketFactory
|
||||
SmtpFactory = javax.net.ssl.SSLSocketFactory
|
||||
|
||||
# Mail Factory Callback
|
||||
# Default: False
|
||||
SmtpFactoryCallback = False
|
||||
|
||||
# Mail Server Auth - Username
|
||||
# Default: exampleuser
|
||||
SmtpUsername = user@gmail.com
|
||||
|
||||
# Mail Server Auth - Password
|
||||
# Default: examplepass
|
||||
SmtpPassword = password
|
||||
|
||||
# Mail Address
|
||||
# Default: None
|
||||
EmailSystemAddress = noreply@myl2jserver.com
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MailList.xsd">
|
||||
<mail id="SATempBan" file="html/SecAuthTempBan.htm" subject="Your account has been temporarily suspended" />
|
||||
</list>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<element name="list">
|
||||
<complexType>
|
||||
<sequence minOccurs="1" maxOccurs="1">
|
||||
<element name="mail" minOccurs="1" maxOccurs="1">
|
||||
<complexType>
|
||||
<attribute name="file" type="token" use="required" />
|
||||
<attribute name="id" type="token" use="required" />
|
||||
<attribute name="subject" type="normalizedString" use="required" />
|
||||
</complexType>
|
||||
</element>
|
||||
</sequence>
|
||||
</complexType>
|
||||
</element>
|
||||
</schema>
|
@ -1,13 +0,0 @@
|
||||
Greetings,<br>
|
||||
<br>
|
||||
We have temporally suspended your account:<br>
|
||||
<br>
|
||||
Account Name: %accountname%<br>
|
||||
Reason: Typed wrong character password %var1% times in row from ip %var0%.<br>
|
||||
Consequences: Your account has been temporaly suspended for %var2% minutes.<br>
|
||||
<br>
|
||||
If you've lost your your character password, you can recover them by <a href="%var3%">clicking here</a>.<br>
|
||||
<br>
|
||||
If you have any question, <a href="mailto:%servermail%">click here</a> to send an email to the administrator.<br>
|
||||
Regards,<br>
|
||||
%servername% Game Master Team
|
@ -103,7 +103,6 @@ public final class Config
|
||||
public static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
public static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
public static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
public static final String EMAIL_CONFIG_FILE = "./config/Email.ini";
|
||||
public static final String CH_SIEGE_FILE = "./config/ConquerableHallSiege.ini";
|
||||
public static final String GEODATA_FILE = "./config/GeoData.ini";
|
||||
|
||||
@ -920,21 +919,6 @@ public final class Config
|
||||
// chatfilter
|
||||
public static List<String> FILTER_LIST;
|
||||
|
||||
// Email
|
||||
public static String EMAIL_SERVERINFO_NAME;
|
||||
public static String EMAIL_SERVERINFO_ADDRESS;
|
||||
public static boolean EMAIL_SYS_ENABLED;
|
||||
public static String EMAIL_SYS_HOST;
|
||||
public static int EMAIL_SYS_PORT;
|
||||
public static boolean EMAIL_SYS_SMTP_AUTH;
|
||||
public static String EMAIL_SYS_FACTORY;
|
||||
public static boolean EMAIL_SYS_FACTORY_CALLBACK;
|
||||
public static String EMAIL_SYS_USERNAME;
|
||||
public static String EMAIL_SYS_PASSWORD;
|
||||
public static String EMAIL_SYS_ADDRESS;
|
||||
public static String EMAIL_SYS_SELECTQUERY;
|
||||
public static String EMAIL_SYS_DBFIELD;
|
||||
|
||||
// Conquerable Halls Settings
|
||||
public static int CHS_CLAN_MINLEVEL;
|
||||
public static int CHS_MAX_ATTACKERS;
|
||||
@ -2771,24 +2755,6 @@ public final class Config
|
||||
MMO_MAX_READ_PER_PASS = mmoSettings.getInt("MaxReadPerPass", 12);
|
||||
MMO_HELPER_BUFFER_COUNT = mmoSettings.getInt("HelperBufferCount", 20);
|
||||
MMO_TCP_NODELAY = mmoSettings.getBoolean("TcpNoDelay", false);
|
||||
|
||||
// Email
|
||||
final PropertiesParser emailSettings = new PropertiesParser(EMAIL_CONFIG_FILE);
|
||||
|
||||
EMAIL_SERVERINFO_NAME = emailSettings.getString("ServerInfoName", "Unconfigured Server");
|
||||
EMAIL_SERVERINFO_ADDRESS = emailSettings.getString("ServerInfoAddress", "info@myl2jserver.com");
|
||||
|
||||
EMAIL_SYS_ENABLED = emailSettings.getBoolean("EmailSystemEnabled", false);
|
||||
EMAIL_SYS_HOST = emailSettings.getString("SmtpServerHost", "smtp.gmail.com");
|
||||
EMAIL_SYS_PORT = emailSettings.getInt("SmtpServerPort", 465);
|
||||
EMAIL_SYS_SMTP_AUTH = emailSettings.getBoolean("SmtpAuthRequired", true);
|
||||
EMAIL_SYS_FACTORY = emailSettings.getString("SmtpFactory", "javax.net.ssl.SSLSocketFactory");
|
||||
EMAIL_SYS_FACTORY_CALLBACK = emailSettings.getBoolean("SmtpFactoryCallback", false);
|
||||
EMAIL_SYS_USERNAME = emailSettings.getString("SmtpUsername", "user@gmail.com");
|
||||
EMAIL_SYS_PASSWORD = emailSettings.getString("SmtpPassword", "password");
|
||||
EMAIL_SYS_ADDRESS = emailSettings.getString("EmailSystemAddress", "noreply@myl2jserver.com");
|
||||
EMAIL_SYS_SELECTQUERY = emailSettings.getString("EmailDBSelectQuery", "SELECT value FROM account_data WHERE account_name=? AND var='email_addr'");
|
||||
EMAIL_SYS_DBFIELD = emailSettings.getString("EmailDBField", "value");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -32,7 +32,6 @@ import java.util.logging.Logger;
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.Server;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.loginserver.mail.MailSystem;
|
||||
import com.l2jmobius.loginserver.network.L2LoginClient;
|
||||
import com.l2jmobius.loginserver.network.L2LoginPacketHandler;
|
||||
import com.l2jmobius.loginserver.network.mmocore.SelectorConfig;
|
||||
@ -106,11 +105,6 @@ public final class L2LoginServer
|
||||
|
||||
loadBanFile();
|
||||
|
||||
if (Config.EMAIL_SYS_ENABLED)
|
||||
{
|
||||
MailSystem.getInstance();
|
||||
}
|
||||
|
||||
InetAddress bindAddress = null;
|
||||
if (!Config.LOGIN_BIND_ADDRESS.equals("*"))
|
||||
{
|
||||
|
@ -1,162 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.loginserver.mail;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.mail.Authenticator;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.PasswordAuthentication;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.Transport;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.loginserver.mail.MailSystem.MailContent;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class BaseMail implements Runnable
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(BaseMail.class.getName());
|
||||
|
||||
private MimeMessage _messageMime = null;
|
||||
|
||||
private class SmtpAuthenticator extends Authenticator
|
||||
{
|
||||
private final PasswordAuthentication _auth;
|
||||
|
||||
public SmtpAuthenticator()
|
||||
{
|
||||
_auth = new PasswordAuthentication(Config.EMAIL_SYS_USERNAME, Config.EMAIL_SYS_PASSWORD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PasswordAuthentication getPasswordAuthentication()
|
||||
{
|
||||
return _auth;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseMail(String account, String mailId, String... args)
|
||||
{
|
||||
final String mailAddr = getUserMail(account);
|
||||
|
||||
if (mailAddr == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final MailContent content = MailSystem.getInstance().getMailContent(mailId);
|
||||
if (content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String message = compileHtml(account, content.getText(), args);
|
||||
|
||||
final Properties mailProp = new Properties();
|
||||
mailProp.put("mail.smtp.host", Config.EMAIL_SYS_HOST);
|
||||
mailProp.put("mail.smtp.auth", Config.EMAIL_SYS_SMTP_AUTH);
|
||||
mailProp.put("mail.smtp.port", Config.EMAIL_SYS_PORT);
|
||||
mailProp.put("mail.smtp.socketFactory.port", Config.EMAIL_SYS_PORT);
|
||||
mailProp.put("mail.smtp.socketFactory.class", Config.EMAIL_SYS_FACTORY);
|
||||
mailProp.put("mail.smtp.socketFactory.fallback", Config.EMAIL_SYS_FACTORY_CALLBACK);
|
||||
final SmtpAuthenticator authenticator = (Config.EMAIL_SYS_SMTP_AUTH ? new SmtpAuthenticator() : null);
|
||||
|
||||
final Session mailSession = Session.getDefaultInstance(mailProp, authenticator);
|
||||
|
||||
try
|
||||
{
|
||||
_messageMime = new MimeMessage(mailSession);
|
||||
_messageMime.setSubject(content.getSubject());
|
||||
try
|
||||
{
|
||||
_messageMime.setFrom(new InternetAddress(Config.EMAIL_SYS_ADDRESS, Config.EMAIL_SERVERINFO_NAME));
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
_log.warning("Sender Address not Valid!");
|
||||
}
|
||||
_messageMime.setContent(message, "text/html");
|
||||
_messageMime.setRecipient(Message.RecipientType.TO, new InternetAddress(mailAddr));
|
||||
}
|
||||
catch (MessagingException e)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private String compileHtml(String account, String html, String[] args)
|
||||
{
|
||||
if (args != null)
|
||||
{
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
html = html.replace("%var" + i + "%", args[i]);
|
||||
}
|
||||
}
|
||||
html = html.replace("%accountname%", account);
|
||||
return html;
|
||||
}
|
||||
|
||||
private String getUserMail(String username)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(Config.EMAIL_SYS_SELECTQUERY))
|
||||
{
|
||||
statement.setString(1, username);
|
||||
try (ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
if (rset.next())
|
||||
{
|
||||
return rset.getString(Config.EMAIL_SYS_DBFIELD);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Cannot select user mail: Exception");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_messageMime != null)
|
||||
{
|
||||
Transport.send(_messageMime);
|
||||
}
|
||||
}
|
||||
catch (MessagingException e)
|
||||
{
|
||||
_log.warning("Error encounterd while sending email");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,152 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.loginserver.mail;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class MailSystem
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(MailSystem.class.getName());
|
||||
private final Map<String, MailContent> _mailData = new ConcurrentHashMap<>();
|
||||
|
||||
public static MailSystem getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
public MailSystem()
|
||||
{
|
||||
loadMails();
|
||||
}
|
||||
|
||||
public void sendMail(String account, String messageId, String... args)
|
||||
{
|
||||
final BaseMail mail = new BaseMail(account, messageId, args);
|
||||
mail.run();
|
||||
}
|
||||
|
||||
private void loadMails()
|
||||
{
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setValidating(false);
|
||||
factory.setIgnoringComments(true);
|
||||
final File file = new File(Config.DATAPACK_ROOT, "data/mail/MailList.xml");
|
||||
Document doc = null;
|
||||
if (file.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
doc = factory.newDocumentBuilder().parse(file);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Could not parse MailList.xml file: " + e.getMessage(), e);
|
||||
return;
|
||||
}
|
||||
|
||||
final Node n = doc.getFirstChild();
|
||||
File mailFile;
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
if (d.getNodeName().equals("mail"))
|
||||
{
|
||||
final String mailId = d.getAttributes().getNamedItem("id").getNodeValue();
|
||||
final String subject = d.getAttributes().getNamedItem("subject").getNodeValue();
|
||||
final String maFile = d.getAttributes().getNamedItem("file").getNodeValue();
|
||||
|
||||
mailFile = new File(Config.DATAPACK_ROOT, "data/mail/" + maFile);
|
||||
try (FileInputStream fis = new FileInputStream(mailFile);
|
||||
BufferedInputStream bis = new BufferedInputStream(fis))
|
||||
{
|
||||
final int bytes = bis.available();
|
||||
final byte[] raw = new byte[bytes];
|
||||
|
||||
bis.read(raw);
|
||||
String html = new String(raw, "UTF-8");
|
||||
html = html.replaceAll(Config.EOL, "\n");
|
||||
html = html.replace("%servermail%", Config.EMAIL_SERVERINFO_ADDRESS);
|
||||
html = html.replace("%servername%", Config.EMAIL_SERVERINFO_NAME);
|
||||
|
||||
_mailData.put(mailId, new MailContent(subject, html));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
_log.warning("IOException while reading " + maFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
_log.info("eMail System Loaded");
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("Cannot load eMail System - Missing file MailList.xml");
|
||||
}
|
||||
}
|
||||
|
||||
public class MailContent
|
||||
{
|
||||
private final String _subject;
|
||||
private final String _text;
|
||||
|
||||
/**
|
||||
* @param subject
|
||||
* @param text
|
||||
*/
|
||||
public MailContent(String subject, String text)
|
||||
{
|
||||
_subject = subject;
|
||||
_text = text;
|
||||
}
|
||||
|
||||
public String getSubject()
|
||||
{
|
||||
return _subject;
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
}
|
||||
|
||||
public MailContent getMailContent(String mailId)
|
||||
{
|
||||
return _mailData.get(mailId);
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final MailSystem _instance = new MailSystem();
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ package com.l2jmobius.loginserver.network;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.network.BaseRecievePacket;
|
||||
import com.l2jmobius.loginserver.GameServerThread;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.BlowFishKey;
|
||||
@ -30,7 +29,6 @@ import com.l2jmobius.loginserver.network.gameserverpackets.PlayerInGame;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.PlayerLogout;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.PlayerTracert;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.ReplyCharacters;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.RequestSendMail;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.RequestTempBan;
|
||||
import com.l2jmobius.loginserver.network.gameserverpackets.ServerStatus;
|
||||
import com.l2jmobius.loginserver.network.loginserverpackets.LoginServerFail;
|
||||
@ -105,10 +103,7 @@ public class L2JGameServerPacketHandler
|
||||
msg = new ReplyCharacters(data, server);
|
||||
break;
|
||||
case 0x09:
|
||||
if (Config.EMAIL_SYS_ENABLED)
|
||||
{
|
||||
msg = new RequestSendMail(data);
|
||||
}
|
||||
// msg = new RequestSendMail(data);
|
||||
break;
|
||||
case 0x0A:
|
||||
msg = new RequestTempBan(data);
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.loginserver.network.gameserverpackets;
|
||||
|
||||
import com.l2jmobius.commons.util.network.BaseRecievePacket;
|
||||
import com.l2jmobius.loginserver.mail.MailSystem;
|
||||
|
||||
/**
|
||||
* @author mrTJO
|
||||
*/
|
||||
public class RequestSendMail extends BaseRecievePacket
|
||||
{
|
||||
String _accountName, _mailId;
|
||||
String[] _args;
|
||||
|
||||
/**
|
||||
* @param decrypt
|
||||
*/
|
||||
public RequestSendMail(byte[] decrypt)
|
||||
{
|
||||
super(decrypt);
|
||||
_accountName = readS();
|
||||
_mailId = readS();
|
||||
final int argNum = readC();
|
||||
_args = new String[argNum];
|
||||
for (int i = 0; i < argNum; i++)
|
||||
{
|
||||
_args[i] = readS();
|
||||
}
|
||||
|
||||
MailSystem.getInstance().sendMail(_accountName, _mailId, _args);
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/mail-1.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
</listAttribute>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/mail-1.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/c3p0-0.9.5.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/ecj-4.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/mchange-commons-java-0.2.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/mysql-connector-java-5.1.43.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;archive detectRoot=&quot;true&quot; path=&quot;/L2J_Mobius_Underground/dist/libs/netty-all-4.1.14.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.archive"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
</listAttribute>
|
||||
|
Loading…
Reference in New Issue
Block a user