-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend_pr.js
129 lines (120 loc) · 3.71 KB
/
send_pr.js
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
// $Id: send_pr.js,v 1.24 2005/08/09 22:25:22 deuce Exp $
load("sbbsdefs.js");
load("gnatslib.js");
const REVISION = "$Revision: 1.24 $".split(' ')[1];
const MAX_LINE_LEN = 78
console.clear();
console.center(format("Synchronet Bug Submission Module %s\r\n", REVISION));
console.crlf();
gnats=new GNATS("bugs.synchro.net","guest");
if(!gnats.connect()) {
writeln(gnats.error);
exit();
}
pr = new Object;
var tmp;
pr.Originator = user.name;
pr.Confidential = console.noyes("Confidential")?'no':'yes';
if(console.aborted)
exit();
console.print("\r\n\1y\1hOne-line synopsis of the problem:\r\n");
pr.Synopsis = truncsp(console.getstr(MAX_LINE_LEN, K_LINE));
if(console.aborted || !pr.Synopsis.length)
exit();
severity = gnats.get_valid("Severity");
for(i=0; i<severity.length; i++) {
console.uselect(i,"Severity",severity[i]);
}
tmp=console.uselect();
if(tmp == -1)
exit();
pr.Severity=severity[tmp];
priority = gnats.get_valid("Priority");
for(i=0; i<priority.length; i++) {
console.uselect(i,"Priority",priority[i]);
}
tmp=console.uselect();
if(tmp == -1)
exit();
pr.Priority=priority[tmp];
allcats=gnats.get_list("Categories");
cats=new Array();
for(i=0; i<allcats.length; i++) {
var flds=allcats[i].split(/:/);
cats.push(flds[0]);
console.uselect(i, "Category", flds[1], "");
}
tmp=console.uselect();
if(tmp == -1)
exit();
pr.Category=cats[tmp];
cls = gnats.get_valid("Class");
for(i=0; i<cls.length; i++) {
if(!gnats.cmd("ADMV","class",cls[i]))
continue;
if(!gnats.expect("ADMV",350))
continue;
var flds=gnats.response.message.split(/:/);
console.uselect(i, "Class", flds[2], "");
}
tmp=console.uselect();
if(tmp == -1)
exit();
pr.Class=cls[tmp];
pr.Version=system.version_notice+system.revision+" Compiled: "+system.compiled_when+" with "+system.compiled_with;
pr.Environment=system.os_version+"\r\n"+system.js_version+"\r\n"+system.socket_lib+"\r\n"+system.msgbase_lib;
console.print("\r\n\1y\1hPrecise description of the problem (Blank line ends):\r\n");
pr.Description = '';
do {
var line=truncsp(console.getstr(MAX_LINE_LEN, K_WRAP | K_LINE));
if(console.aborted)
exit();
pr.Description += line + "\r\n";
} while (line != '' && bbs.online);
console.print("\1y\1hSteps to reproduce the problem (Blank line ends):\r\n");
pr.HowToRepeat = '';
do {
var line=truncsp(console.getstr(MAX_LINE_LEN, K_WRAP | K_LINE));
if(console.aborted)
exit();
pr.HowToRepeat += line + "\r\n";
} while (line != '' && bbs.online);
console.print("\1y\1hFix/Workaround if known (Blank line ends):\r\n");
pr.Fix = '';
do {
var line=truncsp(console.getstr(MAX_LINE_LEN, K_WRAP | K_LINE));
if(console.aborted)
exit();
pr.Fix += line + "\r\n";
} while (line != '' && bbs.online);
var body='';
body += "To: bugs\r\n";
body += "CC:\r\n";
body += "Subject: "+pr.Synopsis+"\r\n";
body += "From: "+user.name+" <"+user.email+">\r\n";
body += "Reply-To: "+user.name+" <"+user.email+">\r\n";
body += "X-Send-Pr-Version: Synchronet send_pr.js\r\n";
body += "\r\n";
body += ">Originator:\t" + pr.Originator + "\r\n";
body += ">Confidential:\t" + pr.Confidential + "\r\n";
body += ">Synopsis:\t" + pr.Synopsis + "\r\n";
body += ">Severity:\t" + pr.Severity + "\r\n";
body += ">Priority:\t" + pr.Priority + "\r\n";
body += ">Category:\t" + pr.Category + "\r\n";
body += ">Class:\t" + pr.Class + "\r\n";
body += ">Version:\t" + pr.Version + "\r\n";
body += ">Environment:\r\n" + pr.Environment + "\r\n";
body += ">Description:\r\n" + pr.Description;
body += ">How-To-Repeat:\r\n" + pr.HowToRepeat;
body += ">Fix:\r\n" + pr.Fix;
// Only submit if the user is still online...
if(bbs.online) {
if(!gnats.submit(body)) {
alert(gnats.error);
console.pause();
} else {
console.print("\1y\1hProblem Report (PR) submitted successfully.\r\n");
console.print(gnats.message);
}
}
gnats.close();