Skip to content

Commit

Permalink
[now]
Browse files Browse the repository at this point in the history
全角数字を半角に変換する処理を追加した。
  • Loading branch information
ambergon committed Nov 19, 2023
1 parent 2b306c0 commit d78ce95
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 34 deletions.
102 changes: 70 additions & 32 deletions code/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@

//なに
//MailIDとyear mm dd hh において、全角を半角に切り替えるシステムを積む
//これらが必要なのは実際に作成者が入力するシーンのみである。



#include <windows.h>
#include <string>
#include <fstream>
Expand Down Expand Up @@ -103,6 +110,21 @@ string Sanitize( string sanitize ){
sanitize = regex_replace( sanitize , regex( "vanishbymyself" ) ,"危険な文字" );
return sanitize;
}
string ZenToHan( string str ){
str = regex_replace( str , regex( "" ) ,"0" );
str = regex_replace( str , regex( "" ) ,"1" );
str = regex_replace( str , regex( "" ) ,"2" );
str = regex_replace( str , regex( "" ) ,"3" );
str = regex_replace( str , regex( "" ) ,"4" );
str = regex_replace( str , regex( "" ) ,"5" );
str = regex_replace( str , regex( "" ) ,"6" );
str = regex_replace( str , regex( "" ) ,"7" );
str = regex_replace( str , regex( "" ) ,"8" );
str = regex_replace( str , regex( "" ) ,"9" );
str = regex_replace( str , regex( " " ) ,"" );
str = regex_replace( str , regex( " " ) ,"" );
return str;
}

//Notified

Expand Down Expand Up @@ -165,11 +187,16 @@ void SendMail( char* GhostMenuName , char* MailID , char* YYYY , char* MM , char
strGhostMenuName = Sanitize( strGhostMenuName );

string strMailID = MailID ;
strMailID = ZenToHan( strMailID );

//二桁にすること。結合すること。
string strYYYY = YYYY ;
strYYYY = ZenToHan( strYYYY );
string strMM = MM ;
strMM = ZenToHan( strMM );
string strDD = DD ;
strDD = ZenToHan( strDD );

//0X月0Y日
stringstream streamMM;
stringstream streamDD;
Expand Down Expand Up @@ -235,6 +262,7 @@ void DeleteMail( char* GhostMenuName , char* MailID ){
strGhostMenuName = Sanitize( strGhostMenuName );

string strMailID = MailID ;
strMailID = ZenToHan( strMailID );

string strCheck;
strCheck = regex_replace( strMailID , regex( R"([0-9])" ) ,"" );
Expand Down Expand Up @@ -262,6 +290,7 @@ int StatusMail( char* GhostMenuName , char* MailID ){
strGhostMenuName = Sanitize( strGhostMenuName );

string strMailID = MailID ;
strMailID = ZenToHan( strMailID );

string strCheck;
strCheck = regex_replace( strMailID , regex( R"([0-9])" ) ,"" );
Expand Down Expand Up @@ -491,7 +520,10 @@ extern "C" __declspec(dllexport) HGLOBAL __cdecl request(HGLOBAL h, long *len){
stringstream streamMailStatus;
streamMailStatus << mailStatus;
string strMailStatus;

string R0 = Reference0;
R0 = ZenToHan( R0 );

strMailStatus = "PLUGIN/2.0 200 OK\r\nCharset: UTF-8\r\nEvent: OnMailStatus\r\nReference0: " + R0 + "\r\nReference1: " + streamMailStatus.str() + "\r\n\r\n";
streamMailStatus.str("");
streamMailStatus.clear( stringstream::goodbit );
Expand All @@ -506,7 +538,9 @@ extern "C" __declspec(dllexport) HGLOBAL __cdecl request(HGLOBAL h, long *len){
}

//メールの状態を確認する機能
//第5引数 メールID
//引数1-4 横流し
//引数 5 メールID
//引数 6 横流し
//
//返り値0-4:横流し
//返り値5 :メールID
Expand All @@ -531,6 +565,7 @@ extern "C" __declspec(dllexport) HGLOBAL __cdecl request(HGLOBAL h, long *len){

//mailID
string strR5 = Reference5;
strR5 = ZenToHan( strR5 );

strR0 = "Reference0: " + strR0 + "\r\n";
strR1 = "Reference1: " + strR1 + "\r\n";
Expand Down Expand Up @@ -569,6 +604,7 @@ extern "C" __declspec(dllexport) HGLOBAL __cdecl request(HGLOBAL h, long *len){
if ( Reference0 != NULL ){

string R0 = Reference0;
R0 = ZenToHan( R0 );

char* MailID ;
char statusMailsSep[] = ":";
Expand Down Expand Up @@ -597,6 +633,39 @@ extern "C" __declspec(dllexport) HGLOBAL __cdecl request(HGLOBAL h, long *len){
}


//要求したゴーストのが今まで送信したすべてのIDを取得する。
} else if ( strcmp( ID , "OnGetAllMailID" ) == 0 ) {
char* err = NULL;
string strGhostMenuName = Sender;
strGhostMenuName = Sanitize( strGhostMenuName );

sqlite3_open16( dbPATH , &db );
string sqlSelect = "select * from mailBox2 where GhostMenuName ='" + strGhostMenuName + "' order by MailID asc";
int sqliteRes = sqlite3_exec( db , sqlSelect.c_str() , callbackAllMailID, NULL , &err );

#ifdef Debug
if ( sqliteRes != 0 ) {
printf( "%s\n" , err );
}
#endif
sqlite3_close( db );

string MailIDs = regex_replace( s.str() , regex( ":$" ) ,"" );
s.str("");
s.clear( stringstream::goodbit );

if ( MailIDs != "" ){
string strGetAllMailID;
strGetAllMailID = "PLUGIN/2.0 200 OK\r\nCharset: UTF-8\r\nEvent: OnAllMailID\r\nReference0: " + MailIDs + "\r\n\r\n";
int i = strlen( strGetAllMailID.c_str() );
char* res_buf;
res_buf = (char*)calloc( i + 1 , sizeof(char) );
memcpy( res_buf , strGetAllMailID.c_str() , i );

resBuf = res_buf;
}


////Userが触る機能
//メールボックス
//┌ └ ┐ ┘ ├ ┤ ─ ┬ ┼ ┴
Expand Down Expand Up @@ -749,37 +818,6 @@ extern "C" __declspec(dllexport) HGLOBAL __cdecl request(HGLOBAL h, long *len){
}


//要求したゴーストのが今まで送信したすべてのIDを取得する。
} else if ( strcmp( ID , "OnGetAllMailID" ) == 0 ) {
char* err = NULL;
string strGhostMenuName = Sender;
strGhostMenuName = Sanitize( strGhostMenuName );

sqlite3_open16( dbPATH , &db );
string sqlSelect = "select * from mailBox2 where GhostMenuName ='" + strGhostMenuName + "' order by MailID asc";
int sqliteRes = sqlite3_exec( db , sqlSelect.c_str() , callbackAllMailID, NULL , &err );

#ifdef Debug
if ( sqliteRes != 0 ) {
printf( "%s\n" , err );
}
#endif
sqlite3_close( db );

string MailIDs = regex_replace( s.str() , regex( ":$" ) ,"" );
s.str("");
s.clear( stringstream::goodbit );

if ( MailIDs != "" ){
string strGetAllMailID;
strGetAllMailID = "PLUGIN/2.0 200 OK\r\nCharset: UTF-8\r\nEvent: OnAllMailID\r\nReference0: " + MailIDs + "\r\n\r\n";
int i = strlen( strGetAllMailID.c_str() );
char* res_buf;
res_buf = (char*)calloc( i + 1 , sizeof(char) );
memcpy( res_buf , strGetAllMailID.c_str() , i );

resBuf = res_buf;
}

////通知内容をOnOtherGhostを悪用して追加する。
//} else if ( strcmp( ID , "OnOtherGhostTalk" ) == 0 && NewMail != 0 ) {
Expand Down
Binary file modified main.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion updates.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ file,ReadMe.mdb660170485b8db8d7696b2832791eb58size=6683date=2023-11-16T12:17:
file,descript.txt52239b0329bee3fb60f6e1abe8fcec37size=403date=2023-11-17T11:30:05
file,developer_options.txt7ca5010be2d3da4867a2ad073fcc2932size=68date=2023-11-11T07:43:28
file,install.txt546820c355858cd0b2302fe5fea5b0fbsize=43date=2023-11-05T22:29:36
file,main.dll90084b0c118c3cbb13434f202556cebfsize=5535437date=2023-11-19T07:20:14
file,main.dll4097cbbde921025ef4881d42b38cc6edsize=5538592date=2023-11-19T20:49:33
2 changes: 1 addition & 1 deletion updates2.dau
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ ReadMe.mdb660170485b8db8d7696b2832791eb58size=6683date=2023-11-16T12:17:38
descript.txt52239b0329bee3fb60f6e1abe8fcec37size=403date=2023-11-17T11:30:05
developer_options.txt7ca5010be2d3da4867a2ad073fcc2932size=68date=2023-11-11T07:43:28
install.txt546820c355858cd0b2302fe5fea5b0fbsize=43date=2023-11-05T22:29:36
main.dll90084b0c118c3cbb13434f202556cebfsize=5535437date=2023-11-19T07:20:14
main.dll4097cbbde921025ef4881d42b38cc6edsize=5538592date=2023-11-19T20:49:33

0 comments on commit d78ce95

Please sign in to comment.