File: spoollist.cc

package info (click to toggle)
bbmail 0.8.3-7
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 784 kB
  • sloc: cpp: 7,307; sh: 3,506; makefile: 83; perl: 26
file content (133 lines) | stat: -rw-r--r-- 2,959 bytes parent folder | download | duplicates (5)
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
//  spoollist.cc for bbmail - an tool to display new mail in X11.
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU 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 General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// (See the included file COPYING / GPL-2.0)
//

#include "spoollist.hh"

SpoolList::SpoolList()
{
	filename=NULL;
	new_maildir=NULL;
	cur_maildir=NULL;
}

SpoolList::~SpoolList()
{
	delete [] filename;
	delete [] new_maildir;
	delete [] cur_maildir;
	delete [] name;
	delete [] runCommand;
	delete [] statusFlag;
	delete [] proc;
	delete [] reversedProc;
	delete [] newmailProc;
}

void SpoolList::LoadFilename(char *value)
{
	int len;

	len =strlen(value);
	filename = new char[len + 1];
	memset(filename, 0, len + 1);
	strncpy(filename, value, len);
	if (type==maildir) {
		new_maildir = new char[len + 5];
		sprintf (new_maildir, "%s/new", value);
		cur_maildir = new char[len + 5];
		sprintf (cur_maildir, "%s/cur", value);
	}
}

void SpoolList::LoadName(char *value)
{
	int len;

	len =strlen(value);
	name = new char[len + 16];
	memset(name, 0, len + 16);
	strncpy(name, value, len);
}

void SpoolList::LoadrunCommand(char *value)
{
	int len;

	len=strlen(value);
	if (value[len-1]!='&') {
		runCommand = new char[len + 2];
		memset(runCommand, 0, len + 2);
		strncpy(runCommand, value, len);
		runCommand[len]='&';
	} else {
		runCommand = new char[len + 1];
		memset(runCommand, 0, len + 1);
		strncpy(runCommand, value, len);
	}
}

void SpoolList::LoadstatusFlag(char *value)
{
	int len;

	len =strlen(value);
	statusFlag = new char[len + 1];
	memset(statusFlag, 0, len + 1);
	strncpy(statusFlag, value, len);
}

void SpoolList::LoadProc(char *value)
{
	int len;

	len =strlen(value);
	proc = new char[len + 2];
	memset(proc, 0, len + 2);
	strncpy(proc, value, len);
	if (value[len-1]!='&') {
		proc[len]='&';
		proc[len+1]='\0';
	}
}

void SpoolList::LoadreversedProc(char *value)
{
	int len;
	len =strlen(value);
	reversedProc = new char[len + 2];
	memset(reversedProc, 0, len + 2);
	strncpy(reversedProc, value, len);
	if (value[len-1]!='&') {
		reversedProc[len]='&';
		reversedProc[len+1]='\0';
	}
}

void SpoolList::LoadnewmailProc(char *value)
{
	int len;
	len =strlen(value);
	newmailProc = new char[len + 2];
	memset(newmailProc, 0, len + 2);
	strncpy(newmailProc, value, len);
	if (value[len-1]!='&') {
		newmailProc[len]='&';
		newmailProc[len+1]='\0';
	}
}