File: xbuffy.h

package info (click to toggle)
xbuffy 3.3.bl.3.dfsg-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 416 kB
  • ctags: 253
  • sloc: ansic: 2,896; sh: 175; makefile: 135
file content (148 lines) | stat: -rw-r--r-- 3,932 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*******************************************************************************

     Copyright (c) 1994,1995    William Pemberton (wfp5p@virginia.edu)
     
     The X Consortium, and any party obtaining a copy of these files from
     the X Consortium, directly or indirectly, is granted, free of charge, a
     full and unrestricted irrevocable, world-wide, paid up, royalty-free,
     nonexclusive right and license to deal in this software and
     documentation files (the "Software"), including without limitation the
     rights to use, copy, modify, merge, publish, distribute, sublicense,
     and/or sell copies of the Software, and to permit persons who receive
     copies from any such party to do so.  This license includes without
     limitation a license to do the foregoing actions under any patents of
     the party supplying this software to the X Consortium.

*******************************************************************************/


#ifndef _XBUFFY_H_
#define _XBUFFY_H_


#include <unistd.h>
#include <X11/Intrinsic.h>
#include "libdyn/dyn.h"

#ifndef HAVE_BCOPY
#define bcopy(x,y,z) memcpy(y,x,z)
#define bzero(S,len) memset(S,0,len)
#endif

#define MAX_STRING 256

#define NEW_MSG 1
#define OLD_MSG 2
#define READ_MSG 4
#define UNKNOWN 8
#define LINEFEED (char) 10

#define X_RESOURCE_CLASS "XBuffy" 

enum BoxType_e {
  MAILBOX = 0,
  MAILDIR,
  MHDIR,
  NNTPBOX,
  CHECKFILE,
  UNKNOWNMBOX,
};

typedef enum BoxType_e BoxType_t;

enum BoxNameType_e {NONE = 0, SHORT, LONG, USR, UNDEF};
typedef enum BoxNameType_e BoxNameType_t;

struct articles_s
{
	long firstNum;
	long lastNum;
};

typedef struct articles_s Articles_t;	


struct BoxInfo_s{
  Widget w;
  int boxNum;			/* the box number */
  char *box;			/* the box filename or newsgroup */
  BoxType_t type;		/* the box type (mail, news, etc) */

  DynObject articles; /* for newsgroups, the read pairs  */

  time_t box_mtime;		/* last time read */
  off_t st_size;		/* size of file on last read */
  int n;				/* the number of messages in the box */
  
  char *command;
  char *audioCmd;
  char *boxTitle;
  int last;
  int pollTime;
  int headerTime;
  int nobeep;
  int nohighlight;
  int origMode;
  char *bgName, *fgName; /* these are only used in the boxfile function */
  Pixel bg,fg;
  BoxNameType_t BoxNameType;
#ifdef USE_LED
  short led;			/* led number */
  int pid;		/* led flasher pid */
#endif
};
typedef struct BoxInfo_s BoxInfo_t;


struct ApplicationData_s
{
    char *mailBoxes;
#ifdef USE_NNTP
    char *newsBoxes;
#endif                          /* USE_NNTP */
    Boolean horiz;
    Boolean shortNames;
    Boolean longNames;
    Boolean origMode;
    Boolean nobeep;
    Boolean nohighlight;
    Boolean center;
    Boolean fill;
    char *pollTime;
    char *headerTime;
    char *audioCmd;
    char *command;
    char *boxFile;
    char *priority;
    Pixel bg, fg;
    Boolean silent;
};

typedef struct ApplicationData_s ApplicationData_t;

#ifdef _AIX
#include <sys/access.h>
#define exists(fname) (access(fname, E_ACC) == 0)
#define canChange(fname) (accessx(fname, (R_ACC | W_ACC), ACC_SELF) == 0)
#else
#define exists(fname) (access(fname, F_OK) == 0)
#define canChange(fname) (access(fname, (R_OK | W_OK)) == 0)
#endif

#define NEWstrlen(s) (s == NULL ? 0 : strlen(s))
#define NEWstrdup(s) (s == NULL ? NULL : strdup(s))

#ifdef USE_NNTP
int CountNNTP(BoxInfo_t *newsBox, DynObject headerString, Boolean *beenTouched);
#endif
void initBox(char *box, BoxType_t BoxType, int pollTime, int headerTime, BoxNameType_t BoxNameType, char *command, char *audioCmd, char *title, Boolean origMode, Boolean nobeep, Boolean nohighlight, char *bgName, char *fgName
#ifdef USE_LED
, int led
#endif
);
void readBoxfile(const char *boxFile);

int cmp_header(const char *, const char *);
int cmp_header_get(const char *buffer, const char *header, const char **p);
int proper_mailstart(const char *);
#endif /* _XBUFFY_H_ */