⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pop3smtp.h

📁 一个功能全面的电子邮件客户端
💻 H
字号:
/* TradeClient <http://tradeclient.sourceforge.net> * $Id: pop3smtp.h,v 1.27 2001/03/20 20:12:35 ttabner Exp $ * * Copyright (C) 1999-2000 Bynari Inc. * Copyright (C) 2001 Project TradeClient * * LGPL * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 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 Library * General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <netdb.h>#include <string.h>#include <unistd.h> #ifndef _POP3_H_#define _POP3_H_#include "puma.h"#include "headers.h"#ifndef TRUE#define TRUE			1==1#endif#ifndef FALSE#define FALSE			1==0#endif#define NDEFACCOUNT		-1 /* acount is not present or set */#define NDEFHOST		-2 /* host name/ip is not set */#define UNKNOWNHOST		-3 /* the host dose not exist */#define CONNREF			-4 /* the connection to the server was refused or invallid */#define CONNOPEN		-5 /* connection allready open */#define CONNCLOSED		-6 /* connection not opened */#define UNKNOWNRESPONSE		-7 /* recived unknown responce from server */#define UNKNOWNERR		-8 /* an unknown error occured while reading				      from the socket, probly lost conenction */#define PARENTSTOP		-9 /* when the parent says STOP (for forking) */#define PARENTSKIP		-10 /* when the parent says SKIP account (for forking) *//* POP3 spefic errors */#define NDEFUSER		-11 /* user was not set */#define NDEFPASSWORD		-12 /* password was not set */#define UNKNOWNUSER		-13 /* server says unknown user */#define INCORRECTPW		-14 /* the password was incorrect */#define UNKNOWNMSG		-15 /* the requested message dose not exist *//* SMTP spefic errors */#define NORELAY			-16 /* server will not relay for spefied domain */#define NOSENDERDOM		-17 /* the sender domain dose not exist */#define NORECPDOM		-18 /* the recipient domain dose not exist */#define NOTOADDRESSES		-19 /* no to address spefied */#define SENDFAILURE             -20 /* Generic send failure */#define POPPERLOCKBUSY          -21 /* Means that something is already using this account *//* POP3 flags */#define REMBER_PASSWORD		(1 << 0)#define REMBER_PASSWORD_ALWAYS	(1 << 1)#define DELETEFROMSERVER	(1 << 2)#define USE_THIS_SIG		(1 << 3)#define USE_THIS_UNIX_SIG	(1 << 4)#define WAITFORPW		(1 << 5)#define CHECK_WITH_ALL          (1 << 6)#define FORCE_FETCH             (1 << 7)#define SSL_CONN		(1 << 8)#define SSL_VERIFY_CERT		(1 << 9)/* Account types */#define POP3 1#define IMAP 2#define NNTP 3#define FILEBOX 4/* Folder status */#define IMAP_FOLDER (1 << 0)//Attachmentlist#define MAXATTACHMENTS 128typedef struct MailMessage_ {  char *to ;  int to_count ;  char *from ;  int popid ;  char *replyto ;  char *cc ;  int cc_count ;  char *bcc ;  int bcc_count ;  char *subject ;  char *timestamp ;  int rr ; // return a message if wanted  char *mailer;  char *organization ;  char *body ;  char *attach[MAXATTACHMENTS] ;  char *attachname[MAXATTACHMENTS] ;  char *attachtype[MAXATTACHMENTS] ;  int attach_count ;  char **extraHeader ;  char **extraValue ;} MailMessage ;int mmpopid;typedef struct Nto_ {	char *email;	char *pers;	char *host;} Nto;typedef struct PopAccount_ {  int id;  char *name;  /* POP3 */  char *phost;  char *puser;  char *ppasswd;  int pport;  /* Added for Imap */  int type;  int imaprecent;  int imapexists;  int lastnew;  int imapmsg;  int mindex;  int uid[1024]; //I know this is NOT ok, but it should be enough  int uiddone[1024];   /* SMTP */  char *shost;  char *suser;  char smode;  int sport; // football?  /* Globs */  int poptmsg;   /* Total Count */  int popcmsg;   /* Current Count */  long flags;  int timeout;  int pid ;  /* This is used to track the child process doing the message processing */  int spid ; /* This is used to track the child process used for sending messages - not used for receives! */  int busy ; /* This flag is TRUE when the account is busy sending/receiving. */  int xport;  /* Optional */  char *folder;  char *real_name;  char *emailaddr;  char *replyaddr;  char *organization;  char *signature;  char *attachdir;  void *extra;  unsigned long check_at;  /* linked list stuff */  struct PopAccount_ *next;} PopAccount ;typedef struct _ImapInfo {        PopAccount *acct;        GtkWidget *tree, *node;	GtkWidget *parent;	char *mailbox;	int lsub;	int row;} ImapInfo;typedef struct _ImapMsg {	PopAccount *acct;	char *mailbox;	int msgno;} ImapMsg;void popaccounts_dump_em_all (char *identifier);/* globaly needed functions */int getnextline (int fd, char *str, int mlen);int getblock (int fd, char *str, unsigned long mlen);/* pop3 spefic functions */int new_popaccount (const char *name, const char *phost,                    const char *puser, const char *ppasswd,                    int pport, const char *shost, const char *suser,                    int sport, unsigned long flags, int timeout, char *folder,                    char *real_name, char *emailaddr, char *replyaddr,                    char *organization, char *signature, char *attachdir, int msgCount, void *extra);PopAccount *seek_popaccount (int id);PopAccount *popaccount_is_my_address (char *address);PopAccount *first_popaccount (void);int seek_popaccount_by_flag (unsigned long flag);int seek_popaccount_by_name (char *name);int destroy_popaccount (int id);int edit_popaccount (int id, const char *name, const char *phost,                    const char *puser, const char *ppasswd,                    int pport, const char *shost, const char *suser,                    int sport, unsigned long flags, int timeout, char *folder,                    char *real_name, char *emailaddr, char *replyaddr,                    char *organization, char *signature, char *attachdir, void *extra);int is_popaccount_password_set (int id);int destroy_popaccount_password (int id);unsigned long get_popaccount_flags (int id);int pop3_login (int id);int pop3_logout (int id);int pop3_num_of_messages (int id);int pop3_last_new_message (int id);char *pop3_get_message (int id, int message, int *error);int pop3_delete_message (int id, int msg);/* smtp spefic functions */int smtpconnect (int id);int new_sendmessage(MailMessage *message);int sendmessage (int id, char *from, int tomembers, char **to, char *data);void smtpdisconnect (int id);void smtphelo (int id, char *domain);int smtpehlo (int id, char *domain);/*checking functions*/int check_to(char *addr);char *popsmtp_error (int err);/* c-client call back stuff */int post_rfc822_output( char *tmp, ENVELOPE *env, BODY *body, soutr_t f, TCPSTREAM *s ) ;int tradeclient_rfc822_output( ENVELOPE *env, BODY *body, soutr_t f, TCPSTREAM *s ) ;long tradeclient_rfc822_output_body( BODY *body, soutr_t f, TCPSTREAM *s ) ;void tradeclient_encode_body( BODY *body ) ;int tradeclient_rfc822_header( ENVELOPE *env, BODY *body, soutr_t f, TCPSTREAM *s ) ;//char *new_pop3_get_message (int id, int message, int *error,MAILSTREAM *stream);int new_pop3_logout (int id, MAILSTREAM *stream);int new_pop3_login (MAILSTREAM **retStream, int id);char *new_pop3_get_message(int id, int message, int *error, MAILSTREAM *stream);#endif /* _POP3_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -