2021-10-30 13:28:48 +02:00
|
|
|
|
// swad_mail.h: everything related to email
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_MAI
|
|
|
|
|
#define _SWAD_MAI
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance in Spanish),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2024-02-07 00:40:28 +01:00
|
|
|
|
Copyright (C) 1999-2024 Antonio Ca<EFBFBD>as Vargas
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-11-29 18:37:45 +01:00
|
|
|
|
#include "swad_constant.h"
|
2017-01-17 03:10:43 +01:00
|
|
|
|
#include "swad_user.h"
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Public types and constants ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-03-08 14:12:33 +01:00
|
|
|
|
#define Mai_MAX_CHARS_MAIL_INFO (128 - 1) // 127
|
|
|
|
|
#define Mai_MAX_BYTES_MAIL_INFO ((Mai_MAX_CHARS_MAIL_INFO + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-09-23 01:49:25 +02:00
|
|
|
|
#define Mai_LENGTH_EMAIL_CONFIRM_KEY Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64
|
|
|
|
|
|
2017-01-29 21:41:08 +01:00
|
|
|
|
#define Mai_NUM_ORDERS 3
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Mai_ORDER_BY_DOMAIN = 0,
|
|
|
|
|
Mai_ORDER_BY_INFO = 1,
|
|
|
|
|
Mai_ORDER_BY_USERS = 2,
|
2017-01-29 12:42:19 +01:00
|
|
|
|
} Mai_DomainsOrder_t;
|
|
|
|
|
#define Mai_ORDER_DEFAULT Mai_ORDER_BY_USERS
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
struct Mail
|
|
|
|
|
{
|
|
|
|
|
long MaiCod;
|
2017-03-13 13:17:53 +01:00
|
|
|
|
char Domain[Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
|
2017-03-07 19:55:29 +01:00
|
|
|
|
char Info[Mai_MAX_BYTES_MAIL_INFO + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned NumUsrs;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Mai_SeeMailDomains (void);
|
|
|
|
|
void Mai_EditMailDomains (void);
|
2016-10-12 14:02:56 +02:00
|
|
|
|
|
2022-09-24 18:30:26 +02:00
|
|
|
|
bool Mai_CheckIfUsrCanReceiveEmailNotif (const struct Usr_Data *UsrDat);
|
2016-10-12 14:02:56 +02:00
|
|
|
|
void Mai_WriteWarningEmailNotifications (void);
|
|
|
|
|
|
2023-03-23 09:35:20 +01:00
|
|
|
|
void Mai_GetMailDomainDataByCod (struct Mail *Plc);
|
2024-04-23 23:54:23 +02:00
|
|
|
|
void Mai_RemoveMailDom (void);
|
|
|
|
|
void Mai_RenameMailDomShrt (void);
|
|
|
|
|
void Mai_RenameMailDomFull (void);
|
2019-04-09 14:04:04 +02:00
|
|
|
|
void Mai_ContEditAfterChgMai (void);
|
2024-04-23 23:54:23 +02:00
|
|
|
|
void Mai_ReceiveNewMailDom (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-04-08 19:42:03 +02:00
|
|
|
|
void Mai_ReqUsrsToListEmails (void);
|
2021-02-22 10:23:55 +01:00
|
|
|
|
void Mai_GetSelUsrsAndListEmails (void);
|
2016-07-01 11:38:53 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
bool Mai_CheckIfEmailIsValid (const char *Email);
|
2022-09-24 18:30:26 +02:00
|
|
|
|
bool Mai_GetEmailFromUsrCod (struct Usr_Data *UsrDat);
|
2015-11-16 14:54:12 +01:00
|
|
|
|
|
2024-01-30 00:20:11 +01:00
|
|
|
|
void Mai_PutFormToGetNewEmail (const char *NewEmail);
|
|
|
|
|
|
2019-02-15 21:09:18 +01:00
|
|
|
|
void Mai_ShowFormChangeMyEmail (bool IMustFillInEmail,bool IShouldConfirmEmail);
|
2018-10-15 14:07:12 +02:00
|
|
|
|
void Mai_ShowFormChangeOtherUsrEmail (void);
|
|
|
|
|
|
2015-11-16 14:54:12 +01:00
|
|
|
|
void Mai_RemoveMyUsrEmail (void);
|
|
|
|
|
void Mai_RemoveOtherUsrEmail (void);
|
2021-05-10 21:10:06 +02:00
|
|
|
|
|
2015-11-16 14:54:12 +01:00
|
|
|
|
void May_NewMyUsrEmail (void);
|
2023-04-04 13:46:51 +02:00
|
|
|
|
void Mai_ChangeOtherUsrEmail (void);
|
2022-09-24 18:30:26 +02:00
|
|
|
|
bool Mai_UpdateEmailInDB (const struct Usr_Data *UsrDat,const char NewEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]);
|
2016-10-10 19:25:25 +02:00
|
|
|
|
|
2021-05-10 21:10:06 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
bool Mai_SendMailMsgToConfirmEmail (void);
|
|
|
|
|
void Mai_ConfirmEmail (void);
|
|
|
|
|
|
2020-04-11 15:21:30 +02:00
|
|
|
|
void Mai_CreateFileNameMail (char FileNameMail[PATH_MAX + 1],FILE **FileMail);
|
2022-11-29 18:37:45 +01:00
|
|
|
|
void Mai_WriteWelcomeNoteEMail (FILE *FileMail,const struct Usr_Data *UsrDat,
|
|
|
|
|
Lan_Language_t ToUsrLanguage);
|
2020-04-11 15:21:30 +02:00
|
|
|
|
void Mai_WriteFootNoteEMail (FILE *FileMail,Lan_Language_t Language);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2024-04-19 12:00:30 +02:00
|
|
|
|
Usr_Can_t Mai_ICanSeeOtherUsrEmail (const struct Usr_Data *UsrDat);
|
2016-04-23 13:23:09 +02:00
|
|
|
|
|
2022-11-29 18:37:45 +01:00
|
|
|
|
int Mai_SendMailMsg (const char FileNameMail[PATH_MAX + 1],
|
|
|
|
|
const char *Subject,
|
|
|
|
|
const char ToEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]);
|
2022-10-20 10:05:24 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#endif
|