140 lines
4.6 KiB
Plaintext
140 lines
4.6 KiB
Plaintext
//**** Mail Checking *******************************************************************
|
|
|
|
/**
|
|
* Answer to check email prompt
|
|
* reference2 - name of the server being checked
|
|
*/
|
|
OnBIFFBegin
|
|
{
|
|
"\0\s[0]Ага, предоставь это Люме.\e"
|
|
|
|
"\0\s[0]Почта? Сейчас проверю.\e"
|
|
|
|
"\0\s[0]\f[name,Hymmnos,hymmnos.ttf]\f[height,16]j.w. mea ADDR => \f[default]\n\n%(reference2)\e"
|
|
}
|
|
|
|
/**
|
|
* Email number successfully retieved.
|
|
* reference0 - number of emails
|
|
* reference2 - name of the server being checked
|
|
* reference7 - the senders and titles delimited by C_BYTE1 characters
|
|
* see: https://ukagakadreamteam.github.io/ukadoc/manual/list_shiori_event.html
|
|
*/
|
|
OnBIFFComplete
|
|
{
|
|
if reference0 == 0
|
|
{
|
|
"\0\s[0]%(username), в ящике пусто. Наверное лучше проверить позже.\e"
|
|
|
|
"\0\s[0]Ничего нового.\e"
|
|
}
|
|
elseif reference0 > 0 && reference0 < 13
|
|
{
|
|
"\0\s[0]Ответ от сервера получен, пришло %( OnCorrectEmailNumberSuffix( reference0 % 10 ) ). Посмотрим?"
|
|
|
|
"\0\s[0]Передача данных завершена. На сервере %( OnCorrectEmailNumberSuffix( reference0 % 10 ) )."
|
|
|
|
"\0\s[0]Письма из Хогвартса там всё ещё нет, но есть %( OnCorrectEmailNumberSuffix( reference0 % 10 ) ) новых писем. Сейчас зачитаю..."
|
|
|
|
--
|
|
|
|
"\n\n\![set,autoscroll,disable]\_q%( OnPrintMailAsList( reference7 ) )\e"
|
|
}
|
|
elseif reference0 > 12 && reference0 < 100
|
|
{
|
|
"\0\s[0]%( OnCorrectEmailNumberSuffix( reference0 % 10 ) ), довольно много. Давай не будем читать каждое.\e"
|
|
}
|
|
elseif reference0 > 99
|
|
{
|
|
"\0\s[0]%( OnCorrectEmailNumberSuffix( reference0 % 10 ) )? %(username), давно ты в последний раз проверял свой почтовый ящик?\e"
|
|
|
|
"\0\s[0]%( OnCorrectEmailNumberSuffix( reference0 % 10 ) ). Наверное, тебе всё таки стоит начать их читать.\e"
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Dialogs in case Lyuma cannot fetch email for some reason
|
|
* reference[0] - error code
|
|
*/
|
|
OnBIFFFailure
|
|
{
|
|
if reference0 == "timeout" //If the connection times out.
|
|
{
|
|
"\0\s[0]Сервер не отвечает, %(username).\e"
|
|
|
|
"\0\s[0]Сервер не отвечает, нет смысла ждать дальше.\e"
|
|
}
|
|
/*
|
|
* If the account blocks the ghost from accessing it.
|
|
* In gmail it might happen if POP access is not allowed in the account settings, or Gmail has not proccessed POP access request yet.
|
|
* might need to wait or go to Gmail > all settings > pop/imap forwarding
|
|
*/
|
|
elseif reference0 == "kick"
|
|
{
|
|
"\0\s[0]Сервер отказал в доступе. Люма что-то сделала не так?\e"
|
|
}
|
|
elseif reference0 == "defect" // If the information put into the POP menu is wrong.
|
|
{
|
|
"\0\s[0]Не получается. С этим аккаунтом что-то не так. Ты точно всё правильно настроил в настройках POP?\e"
|
|
}
|
|
else
|
|
{
|
|
"\0\s[0]Не работает. Вот, что говорит: '%(reference[0])'\e"
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Function that prints a string of email senders and titles as unordered list
|
|
* _argv[0] - a string of entries in format "SenderName <Sender@email.eg> Message title" separated by SOH(U+0001) chars
|
|
* returns formatted headers as list
|
|
* : last modifier will ensure only last return candidate gets returned
|
|
*/
|
|
OnPrintMailAsList : last
|
|
{
|
|
_headers = SPLIT(_argv[0],"")
|
|
_letters = ""
|
|
_headerRegex = "\s*(\S+)\s*<([^>]+)>\s(.*)" // Name <email@example.com> Message title
|
|
|
|
foreach _headers; _header
|
|
{
|
|
if RE_MATCH(_header,_headerRegex) > 0
|
|
{
|
|
_letterTitle = SHIORI3FW.EscapeAllTags(RE_GETSTR[3])
|
|
if RE_GETSTR[3] == ""
|
|
{
|
|
_letterTitle = "<не указано>"
|
|
}
|
|
_letters += "От: %(RE_GETSTR[1]) \nАдрес: %(RE_GETSTR[2]) \nТема: '%(_letterTitle)'\n\n"
|
|
}
|
|
}
|
|
|
|
_letters // returning formatted string
|
|
}
|
|
|
|
/**
|
|
* Function to get a correct spelling for the given given number of emails
|
|
* _argv[0] - number of emails recieved
|
|
* returns - <number> письмо(-сьма,-сем)
|
|
*
|
|
* NOTE: It's not placed in word.dic because its only useful for the function above, there is little use in adding it to the global envelope dictionary
|
|
* furthermore its more of a function than a dictionary
|
|
*/
|
|
OnCorrectEmailNumberSuffix
|
|
{
|
|
case _argv[0]
|
|
{
|
|
when 1
|
|
{
|
|
"одно новое письмо"
|
|
}
|
|
when 2-4
|
|
{
|
|
"%(_argv[0]) новых письма"
|
|
}
|
|
when 0,5,6,7,8,9
|
|
{
|
|
"%(_argv[0]) новых писем"
|
|
}
|
|
}
|
|
}
|