* Removed the inter_athena.conf maildb settings as they are not required anymore.
- MailDB is now an integral part of the MainDB. - To Server Admins, use mysql tools to move your mail data to the new structure. - You can get the maildb structure from main.sql. - Renamed some vars (recomendation of Ultramage :D) git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11557 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
baa7b210d9
commit
a0b1a582a1
@ -4,6 +4,8 @@ Date Added
|
||||
* Rev. 11551 Fixed nopenalty entries for Turbo Track maps. [L0ne_W0lf]
|
||||
* Rev. 11546 Added Turbo Track map flags. [L0ne_W0lf]
|
||||
* Removed the mail_server_enable setting as it's not required. [Zephyrus]
|
||||
* Removed the mail_server database settings from interconf.
|
||||
Now maildb is an integral part of the mainDB. [Zephyrus]
|
||||
2007/10/13
|
||||
* Renamed the config default_skill_delay to default_walk_delay as that is
|
||||
the only thing it does now.
|
||||
|
@ -85,13 +85,6 @@ log_db_id: ragnarok
|
||||
log_db_pw: ragnarok
|
||||
log_db: log
|
||||
|
||||
// MySQL Mail SQL Server
|
||||
mail_server_ip: 127.0.0.1
|
||||
mail_server_port: 3306
|
||||
mail_server_id: ragnarok
|
||||
mail_server_pw: ragnarok
|
||||
mail_server_db: ragnarok
|
||||
|
||||
// for TXT -> SQL convertors
|
||||
db_server_ip: 127.0.0.1
|
||||
db_server_port: 3306
|
||||
|
@ -1,23 +0,0 @@
|
||||
DROP TABLE IF EXISTS `mail`;
|
||||
CREATE TABLE `mail` (
|
||||
`id` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`send_name` tinytext NOT NULL DEFAULT '',
|
||||
`send_id` int(11) unsigned NOT NULL default '0',
|
||||
`dest_name` tinytext NOT NULL DEFAULT '',
|
||||
`dest_id` int(11) unsigned NOT NULL default '0',
|
||||
`title` tinytext NOT NULL DEFAULT '',
|
||||
`message` text NOT NULL DEFAULT '',
|
||||
`time` int(11) unsigned NOT NULL default '0',
|
||||
`read_flag` tinyint(1) unsigned NOT NULL default '0',
|
||||
`zeny` int(11) unsigned NOT NULL default '0',
|
||||
`nameid` int(11) unsigned NOT NULL default '0',
|
||||
`amount` int(11) unsigned NOT NULL default '0',
|
||||
`refine` tinyint(3) unsigned NOT NULL default '0',
|
||||
`attribute` tinyint(4) unsigned NOT NULL default '0',
|
||||
`identify` smallint(6) NOT NULL default '0',
|
||||
`card0` smallint(11) NOT NULL default '0',
|
||||
`card1` smallint(11) NOT NULL default '0',
|
||||
`card2` smallint(11) NOT NULL default '0',
|
||||
`card3` smallint(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM;
|
@ -465,6 +465,34 @@ CREATE TABLE `loginlog` (
|
||||
INDEX (`ip`)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
--
|
||||
-- Table structure for table `mail`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `mail`;
|
||||
CREATE TABLE `mail` (
|
||||
`id` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`send_name` varchar(30) NOT NULL default '',
|
||||
`send_id` int(11) unsigned NOT NULL default '0',
|
||||
`dest_name` varchar(30) NOT NULL default '',
|
||||
`dest_id` int(11) unsigned NOT NULL default '0',
|
||||
`title` varchar(45) NOT NULL default '',
|
||||
`message` varchar(255) NOT NULL default '',
|
||||
`time` int(11) unsigned NOT NULL default '0',
|
||||
`read_flag` tinyint(1) unsigned NOT NULL default '0',
|
||||
`zeny` int(11) unsigned NOT NULL default '0',
|
||||
`nameid` int(11) unsigned NOT NULL default '0',
|
||||
`amount` int(11) unsigned NOT NULL default '0',
|
||||
`refine` tinyint(3) unsigned NOT NULL default '0',
|
||||
`attribute` tinyint(4) unsigned NOT NULL default '0',
|
||||
`identify` smallint(6) NOT NULL default '0',
|
||||
`card0` smallint(11) NOT NULL default '0',
|
||||
`card1` smallint(11) NOT NULL default '0',
|
||||
`card2` smallint(11) NOT NULL default '0',
|
||||
`card3` smallint(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
--
|
||||
-- Table structure for table `memo`
|
||||
--
|
||||
|
@ -32,55 +32,52 @@ int mail_fromsql(int char_id, struct mail_data *md)
|
||||
|
||||
memset(md, 0, sizeof(struct mail_data));
|
||||
md->amount = 0;
|
||||
md->satured = 0;
|
||||
md->full = FALSE;
|
||||
|
||||
StringBuf_Init(&buf);
|
||||
StringBuf_AppendStr(&buf, "SELECT `id`,`send_name`,`send_id`,`dest_name`,`dest_id`,`title`,`message`,`time`,`read_flag`,"
|
||||
"`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`");
|
||||
for (i = 0; i < MAX_SLOTS; i++)
|
||||
StringBuf_Printf(&buf, ",`card%d`", i);
|
||||
StringBuf_Printf(&buf, " FROM `%s` WHERE `dest_id`='%d' ORDER BY `id` LIMIT %d", mail_db, char_id, MAX_MAIL_INBOX + 1);
|
||||
StringBuf_Printf(&buf, " FROM `%s` WHERE `dest_id`='%d' ORDER BY `id` LIMIT %d", mail_db, char_id, MAIL_MAX_INBOX + 1);
|
||||
|
||||
if( SQL_ERROR == Sql_Query(mail_handle, StringBuf_Value(&buf)) )
|
||||
Sql_ShowDebug(mail_handle);
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, StringBuf_Value(&buf)) )
|
||||
Sql_ShowDebug(sql_handle);
|
||||
|
||||
StringBuf_Destroy(&buf);
|
||||
|
||||
for (i = 0; i < MAX_MAIL_INBOX && SQL_SUCCESS == Sql_NextRow(mail_handle); ++i )
|
||||
for (i = 0; i < MAIL_MAX_INBOX && SQL_SUCCESS == Sql_NextRow(sql_handle); ++i )
|
||||
{
|
||||
msg = &md->msg[i];
|
||||
Sql_GetData(mail_handle, 0, &data, NULL); msg->id = atoi(data);
|
||||
Sql_GetData(mail_handle, 1, &data, NULL); safestrncpy(msg->send_name, data, NAME_LENGTH);
|
||||
Sql_GetData(mail_handle, 2, &data, NULL); msg->send_id = atoi(data);
|
||||
Sql_GetData(mail_handle, 3, &data, NULL); safestrncpy(msg->dest_name, data, NAME_LENGTH);
|
||||
Sql_GetData(mail_handle, 4, &data, NULL); msg->dest_id = atoi(data);
|
||||
Sql_GetData(mail_handle, 5, &data, NULL); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH);
|
||||
Sql_GetData(mail_handle, 6, &data, NULL); safestrncpy(msg->body, data, MAIL_BODY_LENGTH);
|
||||
Sql_GetData(mail_handle, 7, &data, NULL); msg->timestamp = atoi(data);
|
||||
Sql_GetData(mail_handle, 8, &data, NULL); msg->read = atoi(data);
|
||||
Sql_GetData(mail_handle, 9, &data, NULL); msg->zeny = atoi(data);
|
||||
Sql_GetData(sql_handle, 0, &data, NULL); msg->id = atoi(data);
|
||||
Sql_GetData(sql_handle, 1, &data, NULL); safestrncpy(msg->send_name, data, NAME_LENGTH);
|
||||
Sql_GetData(sql_handle, 2, &data, NULL); msg->send_id = atoi(data);
|
||||
Sql_GetData(sql_handle, 3, &data, NULL); safestrncpy(msg->dest_name, data, NAME_LENGTH);
|
||||
Sql_GetData(sql_handle, 4, &data, NULL); msg->dest_id = atoi(data);
|
||||
Sql_GetData(sql_handle, 5, &data, NULL); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH);
|
||||
Sql_GetData(sql_handle, 6, &data, NULL); safestrncpy(msg->body, data, MAIL_BODY_LENGTH);
|
||||
Sql_GetData(sql_handle, 7, &data, NULL); msg->timestamp = atoi(data);
|
||||
Sql_GetData(sql_handle, 8, &data, NULL); msg->read = atoi(data);
|
||||
Sql_GetData(sql_handle, 9, &data, NULL); msg->zeny = atoi(data);
|
||||
item = &msg->item;
|
||||
Sql_GetData(mail_handle,10, &data, NULL); item->amount = (short)atoi(data);
|
||||
Sql_GetData(mail_handle,11, &data, NULL); item->nameid = atoi(data);
|
||||
Sql_GetData(mail_handle,12, &data, NULL); item->refine = atoi(data);
|
||||
Sql_GetData(mail_handle,13, &data, NULL); item->attribute = atoi(data);
|
||||
Sql_GetData(mail_handle,14, &data, NULL); item->identify = atoi(data);
|
||||
Sql_GetData(sql_handle,10, &data, NULL); item->amount = (short)atoi(data);
|
||||
Sql_GetData(sql_handle,11, &data, NULL); item->nameid = atoi(data);
|
||||
Sql_GetData(sql_handle,12, &data, NULL); item->refine = atoi(data);
|
||||
Sql_GetData(sql_handle,13, &data, NULL); item->attribute = atoi(data);
|
||||
Sql_GetData(sql_handle,14, &data, NULL); item->identify = atoi(data);
|
||||
|
||||
for (j = 0; j < MAX_SLOTS; j++)
|
||||
{
|
||||
Sql_GetData(mail_handle, 15 + j, &data, NULL);
|
||||
Sql_GetData(sql_handle, 15 + j, &data, NULL);
|
||||
item->card[j] = atoi(data);
|
||||
}
|
||||
}
|
||||
|
||||
if ( SQL_SUCCESS == Sql_NextRow(mail_handle) )
|
||||
md->satured = 1; // New Mails cannot arrive
|
||||
else
|
||||
md->satured = 0;
|
||||
md->full = ( Sql_NumRows(sql_handle) > MAIL_MAX_INBOX );
|
||||
|
||||
md->amount = i;
|
||||
md->changed = 0;
|
||||
Sql_FreeResult(mail_handle);
|
||||
md->changed = FALSE;
|
||||
Sql_FreeResult(sql_handle);
|
||||
|
||||
md->unchecked = 0;
|
||||
md->unreaded = 0;
|
||||
@ -89,8 +86,8 @@ int mail_fromsql(int char_id, struct mail_data *md)
|
||||
msg = &md->msg[i];
|
||||
if (!msg->read)
|
||||
{
|
||||
if ( SQL_ERROR == Sql_Query(mail_handle, "UPDATE `%s` SET `read_flag` = '1' WHERE `id` = '%d'", mail_db, msg->id) )
|
||||
Sql_ShowDebug(mail_handle);
|
||||
if ( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `read_flag` = '1' WHERE `id` = '%d'", mail_db, msg->id) )
|
||||
Sql_ShowDebug(sql_handle);
|
||||
|
||||
md->unchecked++;
|
||||
}
|
||||
@ -114,10 +111,10 @@ int mail_savemessage(struct mail_message *msg)
|
||||
if (!msg)
|
||||
return 0;
|
||||
|
||||
Sql_EscapeStringLen(mail_handle, esc_send_name, msg->send_name, strnlen(msg->send_name, NAME_LENGTH));
|
||||
Sql_EscapeStringLen(mail_handle, esc_dest_name, msg->dest_name, strnlen(msg->dest_name, NAME_LENGTH));
|
||||
Sql_EscapeStringLen(mail_handle, esc_title, msg->title, strnlen(msg->title, MAIL_TITLE_LENGTH));
|
||||
Sql_EscapeStringLen(mail_handle, esc_body, msg->body, strnlen(msg->body, MAIL_BODY_LENGTH));
|
||||
Sql_EscapeStringLen(sql_handle, esc_send_name, msg->send_name, strnlen(msg->send_name, NAME_LENGTH));
|
||||
Sql_EscapeStringLen(sql_handle, esc_dest_name, msg->dest_name, strnlen(msg->dest_name, NAME_LENGTH));
|
||||
Sql_EscapeStringLen(sql_handle, esc_title, msg->title, strnlen(msg->title, MAIL_TITLE_LENGTH));
|
||||
Sql_EscapeStringLen(sql_handle, esc_body, msg->body, strnlen(msg->body, MAIL_BODY_LENGTH));
|
||||
|
||||
StringBuf_Init(&buf);
|
||||
StringBuf_Printf(&buf, "INSERT INTO `%s` (`send_name`, `send_id`, `dest_name`, `dest_id`, `title`, `message`, `time`, `read_flag`, `zeny`, `amount`, `nameid`, `refine`, `attribute`, `identify`", mail_db);
|
||||
@ -129,13 +126,13 @@ int mail_savemessage(struct mail_message *msg)
|
||||
StringBuf_Printf(&buf, ", '%d'", msg->item.card[j]);
|
||||
StringBuf_AppendStr(&buf, ")");
|
||||
|
||||
if( SQL_ERROR == Sql_QueryStr(mail_handle, StringBuf_Value(&buf)) )
|
||||
if( SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) )
|
||||
{
|
||||
Sql_ShowDebug(mail_handle);
|
||||
Sql_ShowDebug(sql_handle);
|
||||
j = 0;
|
||||
}
|
||||
else
|
||||
j = (int)Sql_LastInsertId(mail_handle);
|
||||
j = (int)Sql_LastInsertId(sql_handle);
|
||||
|
||||
StringBuf_Destroy(&buf);
|
||||
|
||||
@ -156,33 +153,33 @@ int mail_loadmessage(int char_id, int mail_id, struct mail_message *message, sho
|
||||
StringBuf_Printf(&buf, ",`card%d`", j);
|
||||
StringBuf_Printf(&buf, " FROM `%s` WHERE `dest_id` = '%d' AND `id` = '%d'", mail_db, char_id, mail_id);
|
||||
|
||||
if( SQL_ERROR == Sql_Query(mail_handle, StringBuf_Value(&buf)) )
|
||||
Sql_ShowDebug(mail_handle);
|
||||
else if( Sql_NumRows(mail_handle) == 0 )
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, StringBuf_Value(&buf)) )
|
||||
Sql_ShowDebug(sql_handle);
|
||||
else if( Sql_NumRows(sql_handle) == 0 )
|
||||
ShowWarning("Char %d trying to read an invalid mail.\n", char_id);
|
||||
else
|
||||
{
|
||||
Sql_NextRow(mail_handle);
|
||||
Sql_NextRow(sql_handle);
|
||||
|
||||
Sql_GetData(mail_handle, 0, &data, NULL); message->id = atoi(data);
|
||||
Sql_GetData(mail_handle, 1, &data, NULL); safestrncpy(message->send_name, data, NAME_LENGTH);
|
||||
Sql_GetData(mail_handle, 2, &data, NULL); message->send_id = atoi(data);
|
||||
Sql_GetData(mail_handle, 3, &data, NULL); safestrncpy(message->dest_name, data, NAME_LENGTH);
|
||||
Sql_GetData(mail_handle, 4, &data, NULL); message->dest_id = atoi(data);
|
||||
Sql_GetData(mail_handle, 5, &data, NULL); safestrncpy(message->title, data, MAIL_TITLE_LENGTH);
|
||||
Sql_GetData(mail_handle, 6, &data, NULL); safestrncpy(message->body, data, MAIL_BODY_LENGTH);
|
||||
Sql_GetData(mail_handle, 7, &data, NULL); message->timestamp = atoi(data);
|
||||
Sql_GetData(mail_handle, 8, &data, NULL); message->read = atoi(data);
|
||||
Sql_GetData(mail_handle, 9, &data, NULL); message->zeny = atoi(data);
|
||||
Sql_GetData(sql_handle, 0, &data, NULL); message->id = atoi(data);
|
||||
Sql_GetData(sql_handle, 1, &data, NULL); safestrncpy(message->send_name, data, NAME_LENGTH);
|
||||
Sql_GetData(sql_handle, 2, &data, NULL); message->send_id = atoi(data);
|
||||
Sql_GetData(sql_handle, 3, &data, NULL); safestrncpy(message->dest_name, data, NAME_LENGTH);
|
||||
Sql_GetData(sql_handle, 4, &data, NULL); message->dest_id = atoi(data);
|
||||
Sql_GetData(sql_handle, 5, &data, NULL); safestrncpy(message->title, data, MAIL_TITLE_LENGTH);
|
||||
Sql_GetData(sql_handle, 6, &data, NULL); safestrncpy(message->body, data, MAIL_BODY_LENGTH);
|
||||
Sql_GetData(sql_handle, 7, &data, NULL); message->timestamp = atoi(data);
|
||||
Sql_GetData(sql_handle, 8, &data, NULL); message->read = atoi(data);
|
||||
Sql_GetData(sql_handle, 9, &data, NULL); message->zeny = atoi(data);
|
||||
item = &message->item;
|
||||
Sql_GetData(mail_handle,10, &data, NULL); item->amount = (short)atoi(data);
|
||||
Sql_GetData(mail_handle,11, &data, NULL); item->nameid = atoi(data);
|
||||
Sql_GetData(mail_handle,12, &data, NULL); item->refine = atoi(data);
|
||||
Sql_GetData(mail_handle,13, &data, NULL); item->attribute = atoi(data);
|
||||
Sql_GetData(mail_handle,14, &data, NULL); item->identify = atoi(data);
|
||||
Sql_GetData(sql_handle,10, &data, NULL); item->amount = (short)atoi(data);
|
||||
Sql_GetData(sql_handle,11, &data, NULL); item->nameid = atoi(data);
|
||||
Sql_GetData(sql_handle,12, &data, NULL); item->refine = atoi(data);
|
||||
Sql_GetData(sql_handle,13, &data, NULL); item->attribute = atoi(data);
|
||||
Sql_GetData(sql_handle,14, &data, NULL); item->identify = atoi(data);
|
||||
for (j = 0; j < MAX_SLOTS; j++)
|
||||
{
|
||||
Sql_GetData(mail_handle,15 + j, &data, NULL);
|
||||
Sql_GetData(sql_handle,15 + j, &data, NULL);
|
||||
item->card[j] = atoi(data);
|
||||
}
|
||||
|
||||
@ -190,14 +187,14 @@ int mail_loadmessage(int char_id, int mail_id, struct mail_message *message, sho
|
||||
}
|
||||
|
||||
StringBuf_Destroy(&buf);
|
||||
Sql_FreeResult(mail_handle);
|
||||
Sql_FreeResult(sql_handle);
|
||||
|
||||
if (message->read == 1)
|
||||
{
|
||||
message->read = 0;
|
||||
if (flag)
|
||||
if ( SQL_ERROR == Sql_Query(mail_handle, "UPDATE `%s` SET `read_flag` = '2' WHERE `id` = '%d'", mail_db, message->id) )
|
||||
Sql_ShowDebug(mail_handle);
|
||||
if ( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `read_flag` = '2' WHERE `id` = '%d'", mail_db, message->id) )
|
||||
Sql_ShowDebug(sql_handle);
|
||||
}
|
||||
else
|
||||
message->read = 1;
|
||||
@ -239,8 +236,8 @@ int mapif_parse_Mail_read(int fd)
|
||||
RFIFOHEAD(fd);
|
||||
|
||||
mail_id = RFIFOL(fd,2);
|
||||
if( SQL_ERROR == Sql_Query(mail_handle, "UPDATE `%s` SET `read_flag` = '2' WHERE `id` = '%d'", mail_db, mail_id) )
|
||||
Sql_ShowDebug(mail_handle);
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `read_flag` = '2' WHERE `id` = '%d'", mail_db, mail_id) )
|
||||
Sql_ShowDebug(sql_handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -259,9 +256,9 @@ int mail_DeleteAttach(int mail_id)
|
||||
StringBuf_Printf(&buf, ", `card%d` = '0'", i);
|
||||
StringBuf_Printf(&buf, " WHERE `id` = '%d'", mail_id);
|
||||
|
||||
if( SQL_ERROR == Sql_Query(mail_handle, StringBuf_Value(&buf)) )
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, StringBuf_Value(&buf)) )
|
||||
{
|
||||
Sql_ShowDebug(mail_handle);
|
||||
Sql_ShowDebug(sql_handle);
|
||||
StringBuf_Destroy(&buf);
|
||||
|
||||
return 0;
|
||||
@ -313,9 +310,9 @@ int mapif_Mail_delete(int fd, int char_id, int mail_id)
|
||||
{
|
||||
short flag = 0;
|
||||
|
||||
if ( SQL_ERROR == Sql_Query(mail_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id) )
|
||||
if ( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id) )
|
||||
{
|
||||
Sql_ShowDebug(mail_handle);
|
||||
Sql_ShowDebug(sql_handle);
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
@ -345,8 +342,8 @@ int mapif_Mail_return(int fd, int char_id, int mail_id)
|
||||
|
||||
if( mail_loadmessage(char_id, mail_id, msg, 0) )
|
||||
{
|
||||
if( SQL_ERROR == Sql_Query(mail_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id) )
|
||||
Sql_ShowDebug(mail_handle);
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id) )
|
||||
Sql_ShowDebug(sql_handle);
|
||||
else
|
||||
{
|
||||
char temp_[MAIL_TITLE_LENGTH];
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
Sql* sql_handle = NULL;
|
||||
Sql* lsql_handle = NULL;
|
||||
Sql* mail_handle = NULL;
|
||||
|
||||
int char_server_port = 3306;
|
||||
char char_server_ip[32] = "127.0.0.1";
|
||||
@ -42,12 +41,6 @@ char login_server_id[32] = "ragnarok";
|
||||
char login_server_pw[32] = "ragnarok";
|
||||
char login_server_db[32] = "ragnarok";
|
||||
|
||||
int mail_server_port = 3306;
|
||||
char mail_server_ip[32] = "127.0.0.1";
|
||||
char mail_server_id[32] = "ragnarok";
|
||||
char mail_server_pw[32] = "ragnarok";
|
||||
char mail_server_db[32] = "ragnarok";
|
||||
|
||||
#ifndef TXT_SQL_CONVERT
|
||||
|
||||
static struct accreg *accreg_pt;
|
||||
@ -278,28 +271,6 @@ static int inter_config_read(const char* cfgName)
|
||||
strcpy(login_server_db, w2);
|
||||
ShowStatus ("set login_server_db : %s\n", w2);
|
||||
}
|
||||
// MAIL SYSTEM
|
||||
else
|
||||
if(!strcmpi(w1,"mail_server_ip")) {
|
||||
strcpy(mail_server_ip, w2);
|
||||
ShowStatus ("set mail_server_ip : %s\n", w2);
|
||||
} else
|
||||
if(!strcmpi(w1,"mail_server_port")) {
|
||||
mail_server_port = atoi(w2);
|
||||
ShowStatus ("set mail_server_port : %s\n", w2);
|
||||
} else
|
||||
if(!strcmpi(w1,"mail_server_id")) {
|
||||
strcpy(mail_server_id, w2);
|
||||
ShowStatus ("set mail_server_id : %s\n", w2);
|
||||
} else
|
||||
if(!strcmpi(w1,"mail_server_pw")) {
|
||||
strcpy(mail_server_pw, w2);
|
||||
ShowStatus ("set mail_server_pw : %s\n", w2);
|
||||
} else
|
||||
if(!strcmpi(w1,"mail_server_db")) {
|
||||
strcpy(mail_server_db, w2);
|
||||
ShowStatus ("set mail_server_db : %s\n", w2);
|
||||
}
|
||||
#ifndef TXT_SQL_CONVERT
|
||||
else if(!strcmpi(w1,"party_share_level"))
|
||||
party_share_level = atoi(w2);
|
||||
@ -344,7 +315,6 @@ int inter_sql_ping(int tid, unsigned int tick, int id, int data)
|
||||
{
|
||||
ShowInfo("Pinging SQL server to keep connection alive...\n");
|
||||
Sql_Ping(sql_handle);
|
||||
Sql_Ping(mail_handle);
|
||||
if( char_gm_read )
|
||||
Sql_Ping(lsql_handle);
|
||||
return 0;
|
||||
@ -389,16 +359,6 @@ int inter_init_sql(const char *file)
|
||||
Sql_Free(sql_handle);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// MAIL SYSTEM
|
||||
mail_handle = Sql_Malloc();
|
||||
ShowInfo("Connect Mail DB server.... (Character Server)\n");
|
||||
if ( SQL_ERROR == Sql_Connect(mail_handle, mail_server_id, mail_server_pw, mail_server_ip, (uint16)mail_server_port, mail_server_db) )
|
||||
{
|
||||
Sql_ShowDebug(mail_handle);
|
||||
Sql_Free(mail_handle);
|
||||
Sql_Free(sql_handle);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifndef TXT_SQL_CONVERT
|
||||
else if (inter_sql_test()) {
|
||||
ShowStatus("Connect Success! (Character Server)\n");
|
||||
@ -411,7 +371,6 @@ int inter_init_sql(const char *file)
|
||||
{
|
||||
Sql_ShowDebug(lsql_handle);
|
||||
Sql_Free(lsql_handle);
|
||||
Sql_Free(mail_handle);
|
||||
Sql_Free(sql_handle);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@ -472,7 +431,6 @@ int inter_sql_test (void)
|
||||
ShowSQL ("Field `%s` not be found in `%s`. Consider updating your database!\n", fields[i], char_db);
|
||||
if( lsql_handle )
|
||||
Sql_Free(lsql_handle);
|
||||
Sql_Free(mail_handle);
|
||||
Sql_Free(sql_handle);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ extern char inter_log_filename[1024];
|
||||
|
||||
extern Sql* sql_handle;
|
||||
extern Sql* lsql_handle;
|
||||
extern Sql* mail_handle;
|
||||
|
||||
extern int char_server_port;
|
||||
extern char char_server_ip[32];
|
||||
@ -40,12 +39,6 @@ extern char login_db_server_id[32];
|
||||
extern char login_db_server_pw[32];
|
||||
extern char login_db_server_db[32];
|
||||
|
||||
extern int mail_server_port;
|
||||
extern char mail_server_ip[32];
|
||||
extern char mail_server_id[32];
|
||||
extern char mail_server_pw[32];
|
||||
extern char mail_server_db[32];
|
||||
|
||||
extern char main_chat_nick[16];
|
||||
|
||||
int inter_accreg_tosql(int account_id, int char_id, struct accreg *reg, int type);
|
||||
|
@ -106,7 +106,7 @@
|
||||
#define HM_CLASS_MAX (HM_CLASS_BASE+MAX_HOMUNCULUS_CLASS-1)
|
||||
|
||||
//Mail System
|
||||
#define MAX_MAIL_INBOX 30
|
||||
#define MAIL_MAX_INBOX 30
|
||||
#define MAIL_TITLE_LENGTH 40
|
||||
#define MAIL_BODY_LENGTH 200
|
||||
|
||||
@ -260,9 +260,9 @@ struct mail_message {
|
||||
|
||||
struct mail_data {
|
||||
short amount;
|
||||
short changed;
|
||||
short satured;
|
||||
struct mail_message msg[MAX_MAIL_INBOX];
|
||||
bool changed, full;
|
||||
|
||||
struct mail_message msg[MAIL_MAX_INBOX];
|
||||
|
||||
short unchecked, unreaded;
|
||||
};
|
||||
|
@ -11326,7 +11326,7 @@ void clif_Mail_refreshinbox(struct map_session_data *sd)
|
||||
WFIFOW(fd,0) = 0x240;
|
||||
WFIFOW(fd,2) = len;
|
||||
WFIFOL(fd,4) = md->amount;
|
||||
for( i = j = 0; i < MAX_MAIL_INBOX && j < md->amount; i++ )
|
||||
for( i = j = 0; i < MAIL_MAX_INBOX && j < md->amount; i++ )
|
||||
{
|
||||
msg = &md->msg[i];
|
||||
if (msg->id < 1)
|
||||
@ -11351,7 +11351,7 @@ void clif_parse_Mail_refreshinbox(int fd, struct map_session_data *sd)
|
||||
nullpo_retv(sd);
|
||||
md = &sd->mail.inbox;
|
||||
|
||||
if( md->amount < MAX_MAIL_INBOX && (md->satured || md->changed) )
|
||||
if( md->amount < MAIL_MAX_INBOX && (md->full || md->changed) )
|
||||
intif_Mail_requestinbox(sd->status.char_id, 1);
|
||||
else
|
||||
clif_Mail_refreshinbox(sd);
|
||||
@ -11367,8 +11367,8 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id)
|
||||
{
|
||||
int i, fd = sd->fd;
|
||||
|
||||
ARR_FIND(0, MAX_MAIL_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if (i < MAX_MAIL_INBOX)
|
||||
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if (i < MAIL_MAX_INBOX)
|
||||
{
|
||||
struct mail_message *msg = &sd->mail.inbox.msg[i];
|
||||
struct item *item = &msg->item;
|
||||
@ -11444,8 +11444,8 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd)
|
||||
int i, mail_id = RFIFOL(fd,2);
|
||||
nullpo_retv(sd);
|
||||
|
||||
ARR_FIND(0, MAX_MAIL_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if (i < MAX_MAIL_INBOX)
|
||||
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if (i < MAIL_MAX_INBOX)
|
||||
{
|
||||
if (sd->mail.inbox.msg[i].zeny < 1 && (sd->mail.inbox.msg[i].item.nameid < 1 || sd->mail.inbox.msg[i].item.amount < 1))
|
||||
return;
|
||||
@ -11485,8 +11485,8 @@ void clif_Mail_delete(struct map_session_data *sd, int mail_id, short flag)
|
||||
if (!flag)
|
||||
{
|
||||
int i;
|
||||
ARR_FIND(0, MAX_MAIL_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if( i < MAX_MAIL_INBOX )
|
||||
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if( i < MAIL_MAX_INBOX )
|
||||
{
|
||||
memset(&sd->mail.inbox.msg[i], 0, sizeof(struct mail_message));
|
||||
sd->mail.inbox.amount--;
|
||||
@ -11499,7 +11499,7 @@ void clif_Mail_delete(struct map_session_data *sd, int mail_id, short flag)
|
||||
WFIFOW(fd,6) = flag;
|
||||
WFIFOSET(fd, packet_len(0x257));
|
||||
|
||||
if( !flag && sd->mail.inbox.satured )
|
||||
if( !flag && sd->mail.inbox.full )
|
||||
intif_Mail_requestinbox(sd->status.char_id, 1); // Reload the Mail Inbox
|
||||
}
|
||||
|
||||
@ -11508,8 +11508,8 @@ void clif_parse_Mail_delete(int fd, struct map_session_data *sd)
|
||||
int i, mail_id = RFIFOL(fd,2);
|
||||
nullpo_retv(sd);
|
||||
|
||||
ARR_FIND(0, MAX_MAIL_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if (i < MAX_MAIL_INBOX)
|
||||
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if (i < MAIL_MAX_INBOX)
|
||||
{
|
||||
struct mail_message *msg = &sd->mail.inbox.msg[i];
|
||||
|
||||
@ -11543,8 +11543,8 @@ void clif_parse_Mail_return(int fd, struct map_session_data *sd)
|
||||
int i, mail_id = RFIFOL(fd,2);
|
||||
nullpo_retv(sd);
|
||||
|
||||
ARR_FIND(0, MAX_MAIL_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if (i < MAX_MAIL_INBOX)
|
||||
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if (i < MAIL_MAX_INBOX)
|
||||
intif_Mail_return(sd->status.char_id, mail_id);
|
||||
}
|
||||
|
||||
@ -11555,8 +11555,8 @@ void clif_Mail_return(struct map_session_data *sd, int mail_id, int new_mail)
|
||||
if (new_mail > 0)
|
||||
{
|
||||
int i;
|
||||
ARR_FIND(0, MAX_MAIL_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if (i < MAX_MAIL_INBOX)
|
||||
ARR_FIND(0, MAIL_MAX_INBOX, i, sd->mail.inbox.msg[i].id == mail_id);
|
||||
if (i < MAIL_MAX_INBOX)
|
||||
{
|
||||
struct map_session_data *rd = map_charid2sd(sd->mail.inbox.msg[i].send_id);
|
||||
if (rd)
|
||||
|
Loading…
x
Reference in New Issue
Block a user