summaryrefslogtreecommitdiff
path: root/src/map/mail.c
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-23 20:38:44 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-23 20:38:44 +0000
commit2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b (patch)
tree89c47d81729687d5a69cadde99ee350306eb814f /src/map/mail.c
parentc4e6857d4774b25dcd9b9137f76c14c92015d691 (diff)
downloadhercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.tar.gz
hercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.tar.bz2
hercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.tar.xz
hercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.zip
update
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@968 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mail.c')
-rw-r--r--src/map/mail.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/map/mail.c b/src/map/mail.c
index 5d63b6f80..74d2bf7c0 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -30,12 +30,12 @@ extern char msg_table[1000][256]; // Server messages (0-499 reserved for GM comm
int mail_check(struct map_session_data *sd,int type)
{
- int i=0,new=0,priority=0;
+ int i=0,new_=0,priority=0;
char message[50];
if(sd==NULL)
return 0;
-
+
sprintf(tmp_msql,"SELECT `message_id`,`to_account_id`,`from_char_name`,`read_flag`,`priority`,`check_flag` FROM `%s` WHERE `to_account_id` = \"%d\" ORDER by `message_id`", mail_db, sd->status.account_id);
if (mysql_query(&mail_handle, tmp_msql)) {
@@ -64,7 +64,7 @@ int mail_check(struct map_session_data *sd,int type)
}
if(!atoi(mail_row[3])) {
- new++;
+ new_++;
if(atoi(mail_row[4]))
priority++;
if(type==2 || type==3) {
@@ -88,28 +88,28 @@ int mail_check(struct map_session_data *sd,int type)
sprintf(message, msg_table[513], i, mail_row[2]);
clif_displaymessage(sd->fd, jstrescape(message));
}
-
+
}
-
+
mysql_free_result(mail_res);
-
+
} else {
printf("MySQL error (storing query result for %s): %s\n", mail_db, mysql_error(&mail_handle));
return 0;
}
- if(i>0 && new>0 && type==1) {
- //sprintf(message, "You have %d new messages.", new);
- sprintf(message, msg_table[514], new);
+ if(i>0 && new_>0 && type==1) {
+ //sprintf(message, "You have %d new messages.", new_);
+ sprintf(message, msg_table[514], new_);
clif_displaymessage(sd->fd, jstrescape(message));
}
- if(i>0 && new>0 && priority>0 && type==1) {
+ if(i>0 && new_>0 && priority>0 && type==1) {
//sprintf(message, "You have %d unread priority messages.", priority);
sprintf(message, msg_table[515], priority);
clif_displaymessage(sd->fd, jstrescape(message));
}
- if(!new) {
+ if(!new_) {
//clif_displaymessage(sd->fd, "You have no new messages.");
clif_displaymessage(sd->fd, msg_table[516]);
}
@@ -124,7 +124,7 @@ int mail_read(struct map_session_data *sd, int message_id)
if(sd==NULL)
return 0;
-
+
sprintf(tmp_msql,"SELECT `message_id`,`to_account_id`,`from_char_name`,`message`,`read_flag`,`priority`,`check_flag` from `%s` WHERE `to_account_id` = \"%d\" ORDER by `message_id` LIMIT %d, 1",mail_db,sd->status.account_id,message_id-1);
if (mysql_query(&mail_handle, tmp_msql)) {
@@ -162,9 +162,9 @@ int mail_read(struct map_session_data *sd, int message_id)
printf("DB server Error (update Read `%s`)- %s\n", mail_db, mysql_error(&mail_handle) );
}
}
-
+
mysql_free_result(mail_res);
-
+
} else {
printf("MySQL error (storing query result for %s): %s\n", mail_db, mysql_error(&mail_handle));
return 0;
@@ -177,7 +177,7 @@ int mail_delete(struct map_session_data *sd, int message_id)
{
if(sd==NULL)
return 0;
-
+
sprintf(tmp_msql,"SELECT `message_id`,`to_account_id`,`read_flag`,`priority`,`check_flag` from `%s` WHERE `to_account_id` = \"%d\" ORDER by `message_id` LIMIT %d, 1",mail_db,sd->status.account_id,message_id-1);
if (mysql_query(&mail_handle, tmp_msql)) {
@@ -217,9 +217,9 @@ int mail_delete(struct map_session_data *sd, int message_id)
//else clif_displaymessage(sd->fd,"Message deleted.");
else clif_displaymessage(sd->fd,msg_table[521]);
}
-
+
mysql_free_result(mail_res);
-
+
} else {
printf("MySQL error (delete query result for %s): %s\n", mail_db, mysql_error(&mail_handle));
return 0;
@@ -232,7 +232,7 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag)
{
if(sd==NULL)
return 0;
-
+
if(pc_isGM(sd) < 80 && sd->mail_counter > 0) {
//clif_displaymessage(sd->fd,"You must wait 10 minutes before sending another message");
clif_displaymessage(sd->fd,msg_table[522]);
@@ -254,8 +254,8 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag)
if (mysql_query(&mail_handle, tmp_msql)) {
printf("Database server error (executing query for %s): %s\n", char_db, mysql_error(&mail_handle));
return 0;
- }
-
+ }
+
mail_res = mysql_store_result(&mail_handle);
if(mail_res) {
if (mysql_num_rows(mail_res) == 0) {
@@ -268,7 +268,7 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag)
while ((mail_row = mysql_fetch_row(mail_res))) {
if(strcmp(name,"*")==0) {
sprintf(tmp_msql, "INSERT DELAYED INTO `%s` (`to_account_id`,`from_account_id`,`from_char_name`,`message`,`priority`)"
- " VALUES ('%d', '%d', '%s', '%s', '%d')",mail_db, atoi(mail_row[0]), sd->status.account_id, sd->status.name, jstrescape(message), flag);
+ " VALUES ('%d', '%d', '%s', '%s', '%d')",mail_db, atoi(mail_row[0]), sd->status.account_id, sd->status.name, jstrescape(message), flag);
}
else {
sprintf(tmp_msql, "INSERT DELAYED INTO `%s` (`to_account_id`,`to_char_name`,`from_account_id`,`from_char_name`,`message`,`priority`)"
@@ -276,7 +276,7 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag)
if(pc_isGM(sd) < 80)
sd->mail_counter=5;
}
-
+
if(mysql_query(&mail_handle, tmp_msql) ) {
mysql_free_result(mail_res);
printf("DB server Error (insert `mail_db`)- %s\n", mysql_error(&mail_handle) );
@@ -295,18 +295,18 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag)
int mail_check_timer(int tid,unsigned int tick,int id,int data)
{
struct map_session_data *sd = NULL;
- int i;
+ int i;
if(mail_timer != tid)
return 0;
sprintf(tmp_msql,"SELECT DISTINCT `to_account_id` FROM `%s` WHERE `read_flag` = '0' AND `check_flag` = '0'", mail_db);
-
+
if (mysql_query(&mail_handle, tmp_msql)) {
printf("Database server error (executing query for %s): %s\n", char_db, mysql_error(&mail_handle));
mail_timer=add_timer(gettick()+MAIL_CHECK_TIME,mail_check_timer,0,0);
return 0;
- }
+ }
mail_res = mysql_store_result(&mail_handle);
@@ -324,8 +324,8 @@ int mail_check_timer(int tid,unsigned int tick,int id,int data)
if(pc_isGM(sd) < 80 && sd->mail_counter > 0)
sd->mail_counter--;
if(sd->status.account_id==atoi(mail_row[0]))
- //clif_displaymessage(sd->fd, "You have new mail.");
- clif_displaymessage(sd->fd, msg_table[526]);
+ //clif_displaymessage(sd->fd, "You have new mail.");
+ clif_displaymessage(sd->fd, msg_table[526]);
}
}
}
@@ -341,7 +341,7 @@ int mail_check_timer(int tid,unsigned int tick,int id,int data)
}
int do_init_mail(void)
-{
+{
add_timer_func_list(mail_check_timer,"mail_check_timer");
mail_timer=add_timer(gettick()+MAIL_CHECK_TIME,mail_check_timer,0,0);
return 0;