File: warning.c

package info (click to toggle)
fbb 7.07-3
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 5,244 kB
  • ctags: 8,123
  • sloc: ansic: 87,810; sh: 2,324; makefile: 297
file content (183 lines) | stat: -rw-r--r-- 4,786 bytes parent folder | download | duplicates (8)
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
   /****************************************************************
    Copyright (C) 1986-2000 by

    F6FBB - Jean-Paul ROUBELAT
    6, rue George Sand
    31120 - Roquettes - France
	jpr@f6fbb.org

    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    Parts of code have been taken from many other softwares.
    Thanks for the help.
    ****************************************************************/

#include <serv.h>

/* Module gerant les messages "warning" */




/*
 * Demande de message warning :
 *
 * 1 - PingPong
 * 2 - Route inconnue
 * 3 - NTS inconnu
 *
 */

void dde_warning (int type)
{
	pvoie->warning |= type;
}

void tst_warning (bullist * ptmes)
{
	char wtexte[256];
	char nom[128];
	unsigned warning = pvoie->warning;

	while (warning)
	{
		if (warning & W_PPG)
		{
#ifdef ENGLISH
			sprintf (wtexte,
					 "Duplicate reverse forward of # %ld to %s, route to %s",
					 ptmes->numero, ptmes->desti, ptmes->bbsv
				);
			if (w_mask & W_PINGPONG)
				mess_warning (admin, "*** PING-PONG ***", wtexte);
#else
			sprintf (wtexte,
					 "Presentation en retour du # %ld a %s, routage vers %s",
					 ptmes->numero, ptmes->desti, ptmes->bbsv
				);
			if (w_mask & W_PINGPONG)
				mess_warning (admin, "*** PING-PONG ***", wtexte);
#endif
			warning &= ~(W_PPG);
		}
		else if (warning & W_ROU)
		{
#ifdef ENGLISH
			sprintf (wtexte,
					 "Unknown route to %s.   \rMessage #%ld written by %s received %s     \r",
					 ptmes->bbsv, ptmes->numero,
					 ptmes->exped, strdate (time (NULL))
				);
			if (w_mask & W_NO_ROUTE)
				mess_warning (admin, "*** UNKNOWN ROUTE ***       ", wtexte);
#else
			sprintf (wtexte,
					 "Acheminement vers %s inconnu.\rMessage %ld demande par %s recu le %s\r",
					 ptmes->bbsv, ptmes->numero,
					 ptmes->exped, strdate (time (NULL))
				);
			if (w_mask & W_NO_ROUTE)
				mess_warning (admin, "*** ACHEMINEMENT INCONNU ***", wtexte);
#endif
			warning &= ~(W_ROU);
		}
		else if (warning & W_NTS)
		{
#ifdef ENGLISH
			sprintf (wtexte,
			   "Unknown NTS %s. \rMessage #%ld written by %s received %s\r",
					 ptmes->desti, ptmes->numero,
					 ptmes->exped, strdate (time (NULL))
				);
			if (w_mask & W_NO_NTS)
				mess_warning (admin, "*** UNKNOWN NTS ***", wtexte);
#else
			sprintf (wtexte,
			   "NTS  %s inconnu.\rMessage %ld demande par %s recu le %s \r",
					 ptmes->desti, ptmes->numero,
					 ptmes->exped, strdate (time (NULL))
				);
			if (w_mask & W_NO_NTS)
				mess_warning (admin, "*** NTS INCONNU ***", wtexte);
#endif
			warning &= ~(W_NTS);
		}
		else if (warning & W_ASC)
		{
			mess_name (MESSDIR, ptmes->numero, nom);
#ifdef ENGLISH
			sprintf (wtexte,
					 "Ascii file %s not found    \r", nom
				);
			if (w_mask & W_MESSAGE)
				mess_warning (admin, "*** ASCII FILE NOT FOUND ***", wtexte);
#else
			sprintf (wtexte,
					 "Fichier ascii %s pas trouve\r", nom
				);
			if (w_mask & W_MESSAGE)
				mess_warning (admin, "*** ERREUR FICHIER ASCII ***", wtexte);
#endif
			warning &= ~(W_ASC);
		}
		else if (warning & W_BIN)
		{
			mess_name (MBINDIR, ptmes->numero, nom);
#ifdef ENGLISH
			sprintf (wtexte,
					 "Binary file %s not found     \r", nom
				);
			if (w_mask & W_MESSAGE)
				mess_warning (admin, "*** BIN FILE NOT FOUND ***", wtexte);
#else
			sprintf (wtexte,
					 "Fichier binaire %s pas trouve\r", nom
				);
			if (w_mask & W_MESSAGE)
				mess_warning (admin, "*** ERREUR FICHIER BIN ***", wtexte);
#endif
			warning &= ~(W_BIN);
		}
	}
	pvoie->warning = 0;
}

void mess_warning (char *w_desti, char *w_titre, char *w_texte)
{
	int nb, sav_voie = voiecur, sav_lang = vlang;

	if (voiecur == MWARNING)
		return;					/* Deja en warning */

	deb_io ();
	selvoie (MWARNING);
	if (FOR (svoie[sav_voie]->mode))
		pvoie->mode |= F_FOR;
	entete_saisie ();
	ini_champs (voiecur);
	strn_cpy (6, ptmes->desti, w_desti);
	strcpy (ptmes->exped, mycall);
	ptmes->type = 'P';
	swapp_bbs (ptmes);
	reacheminement ();
	strn_cpy (60, ptmes->titre, w_titre);
	pvoie->mode = F_FOR;
	nb = strlen (w_texte);
	w_texte[nb] = '\032';
	get_mess_fwd ('\0', w_texte, nb + 1, 2);
	selvoie (sav_voie);
	vlang = sav_lang;
	fin_io ();
}