if (is_bnet_error(fd)) {
Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"),
- job_type_to_str(jcr->JobType), bnet_strerror(fd));
+ job_type_to_str(jcr->JobType), fd->bstrerror());
}
bnet_sig(fd, BNET_TERMINATE); /* tell Client we are terminating */
-/*
- *
- * Bacula Director -- routines to receive network data and
- * handle network signals. These routines handle the connections
- * to the Storage daemon and the File daemon.
- *
- * Kern Sibbald, August MM
- *
- * This routine runs as a thread and must be thread reentrant.
- *
- * Basic tasks done here:
- * Handle network signals (signals).
- * Signals always have return status 0 from bnet_recv() and
- * a zero or negative message length.
- * Pass appropriate messages back to the caller (responses).
- * Responses always have a digit as the first character.
- * Handle requests for message and catalog services (requests).
- * Requests are any message that does not begin with a digit.
- * In affect, they are commands.
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ *
+ * Bacula Director -- routines to receive network data and
+ * handle network signals. These routines handle the connections
+ * to the Storage daemon and the File daemon.
+ *
+ * Kern Sibbald, August MM
+ *
+ * This routine runs as a thread and must be thread reentrant.
+ *
+ * Basic tasks done here:
+ * Handle network signals (signals).
+ * Signals always have return status 0 from bnet_recv() and
+ * a zero or negative message length.
+ * Pass appropriate messages back to the caller (responses).
+ * Responses always have a digit as the first character.
+ * Handle requests for message and catalog services (requests).
+ * Requests are any message that does not begin with a digit.
+ * In affect, they are commands.
+ *
+ * Version $Id$
+ */
#include "bacula.h"
#include "dird.h"
for (;;) {
n = bs->recv();
- Dmsg2(900, "bget_dirmsg %d: %s", n, bs->msg);
+ Dmsg2(100, "bget_dirmsg %d: %s", n, bs->msg);
if (is_bnet_stop(bs)) {
return n; /* error or terminate */
if (do_prompt(ua, _("Job"), _("Choose Job to cancel"), buf, sizeof(buf)) < 0) {
return 1;
}
- if (njobs == 1) {
- if (!get_yesno(ua, _("Confirm cancel (yes/no): ")) || ua->pint32_val == 0) {
+ if (ua->api && njobs == 1) {
+ char nbuf[1000];
+ bsnprintf(nbuf, sizeof(nbuf), _("Cancel: %s\n\n%s"), buf,
+ _("Confirm cancel?"));
+ if (!get_yesno(ua, nbuf) || ua->pint32_val == 0) {
return 1;
}
+ } else {
+ if (njobs == 1) {
+ if (!get_yesno(ua, _("Confirm cancel (yes/no): ")) || ua->pint32_val == 0) {
+ return 1;
+ }
+ }
}
sscanf(buf, "JobId=%d Job=%127s", &njobs, JobName);
jcr = get_jcr_by_full_name(JobName);
static int delete_volume(UAContext *ua)
{
MEDIA_DBR mr;
+ char buf[1000];
if (!select_media_dbr(ua, &mr)) {
return 1;
"and all Jobs saved on that volume from the Catalog\n"),
mr.VolumeName);
- if (!get_yesno(ua, _("Are you sure you want to delete this Volume? (yes/no): "))) {
+ bsnprintf(buf, sizeof(buf), _("Are you sure you want to delete Volume \"%s\"? (yes/no): "),
+ mr.VolumeName);
+ if (!get_yesno(ua, buf)) {
return 1;
}
if (ua->pint32_val) {
static int delete_pool(UAContext *ua)
{
POOL_DBR pr;
+ char buf[200];
memset(&pr, 0, sizeof(pr));
if (!get_pool_dbr(ua, &pr)) {
return 1;
}
- if (!get_yesno(ua, _("Are you sure you want to delete this Pool? (yes/no): "))) {
+ bsnprintf(buf, sizeof(buf), _("Are you sure you want to delete Pool \"%s\"? (yes/no): "),
+ pr.Name);
+ if (!get_yesno(ua, buf)) {
return 1;
}
if (ua->pint32_val) {
int ret;
ua->pint32_val = 0;
for (;;) {
+ if (ua->api) ua->UA_sock->signal(BNET_YESNO);
if (!get_cmd(ua, prompt)) {
return false;
}
}
ua->send_msg("%4d %s\n", vl->Slot, vl->VolName);
}
- if (!get_yesno(ua, _("Do you want to continue? (yes|no): ")) ||
+ if (!get_yesno(ua, _("Do you want to label these Volumes? (yes|no): ")) ||
(ua->pint32_val == 0)) {
goto bail_out;
}
POOL *pool;
POOL_DBR pr;
POOLMEM *query;
+ char buf[1000];
char ed1[130];
bool done = false;
int i;
case 8: /* InChanger */
ua->info_msg(_("Current InChanger flag is: %d\n"), mr.InChanger);
- if (!get_yesno(ua, _("Set InChanger flag? yes/no: "))) {
+ bsnprintf(buf, sizeof(buf), _("Set InChanger flag for Volume \"%s\": yes/no: "),
+ mr.VolumeName);
+ if (!get_yesno(ua, buf)) {
return 0;
}
mr.InChanger = ua->pint32_val;
VolFiles = ua->pint32_val;
if (VolFiles != (int)(mr.VolFiles + 1)) {
ua->warning_msg(_("Normally, you should only increase Volume Files by one!\n"));
- if (!get_yesno(ua, _("Continue? (yes/no): ")) || ua->pint32_val == 0) {
+ if (!get_yesno(ua, _("Increase Volume Files? (yes/no): ")) || ua->pint32_val == 0) {
break;
}
}
bool is_duped() { return m_duped; };
bool is_terminated() { return m_terminated; };
bool is_timed_out() { return m_timed_out; };
+ bool is_stop() { return errors || is_terminated(); }
+ bool is_error() { errno = b_errno; return errors; }
void set_spooling() { m_spool = true; };
void clear_spooling() { m_spool = false; };
void set_duped() { m_duped = true; };
BNET_WARNING_MSG = -20, /* Warning message */
BNET_ERROR_MSG = -21, /* Error message -- command failed */
BNET_INFO_MSG = -22, /* Info message -- status line */
- BNET_RUN_CMD = -23 /* Run command follows */
+ BNET_RUN_CMD = -23, /* Run command follows */
+ BNET_YESNO = -24 /* Request yes no response */
};
#define BNET_SETBUF_READ 1 /* Arg for bnet_set_buffer_size */
if (mainWin->m_commDebug) Pmsg0(000, "START SELECT\n");
new selectDialog(this);
break;
+ case BNET_YESNO:
+ if (mainWin->m_commDebug) Pmsg0(000, "YESNO\n");
+ new yesnoPopUp(this);
+ break;
case BNET_RUN_CMD:
if (mainWin->m_commDebug) Pmsg0(000, "RUN CMD\n");
new runCmdPage();
{
m_index = index;
}
+
+/*
+ * Handle yesno PopUp when Bacula asks a yes/no question.
+ */
+/*
+ * Read the items for the selection
+ */
+yesnoPopUp::yesnoPopUp(Console *console)
+{
+ QMessageBox msgBox;
+
+ setAttribute(Qt::WA_DeleteOnClose);
+ console->read(); /* get yesno question */
+ msgBox.setWindowTitle("Bat Question");
+ msgBox.setText(console->msg());
+ msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+ console->displayToPrompt();
+ switch (msgBox.exec()) {
+ case QMessageBox::Yes:
+ console->write_dir("yes");
+ break;
+ case QMessageBox::No:
+ console->write_dir("no");
+ break;
+ }
+ console->displayToPrompt();
+ mainWin->resetFocus();
+}
};
+class yesnoPopUp : public QDialog
+{
+ Q_OBJECT
+
+public:
+ yesnoPopUp(Console *console);
+
+};
+
+
#endif /* _SELECT_H_ */
#undef VERSION
#define VERSION "2.1.29"
-#define BDATE "22 July 2007"
-#define LSMDATE "22Jul07"
+#define BDATE "24 July 2007"
+#define LSMDATE "24Jul07"
#define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n"
#define BYEAR "2007" /* year for copyright messages in progs */
Technical notes on version 2.1
General:
+24Jul07
+kes Implement PopUp YES/NO dialog for bat.
23Jul07
ebl Fix a compilation bug when using #define BACL_WANT_NUMERIC_IDS
22Jul07