Permalink
Browse files

- backup_statefile

  • Loading branch information...
cvs
cvs committed Nov 19, 2011
1 parent 3a1e479 commit d33a505748c78950fa660d20d67a1f5be90b9525
Showing with 31 additions and 14 deletions.
  1. +3 −0 LIESMICH.modDinoex
  2. +3 −0 README.modDinoex
  3. +2 −0 src/dinoex_admin.c
  4. +18 −0 src/dinoex_jobs.c
  5. +1 −0 src/dinoex_jobs.h
  6. +2 −0 src/iroffer_admin.c
  7. +2 −14 src/iroffer_statefile.c
View
@@ -3,6 +3,9 @@ Aktuelle Version auf: http://iroffer.dinoex.net/
Ab Version 3.28:
----------------
+386) CLEARRECORDS, CLEARGETS
+ Erstelle ein Backup des "statefiles" vor dem L�schen.
+
385) ruby_script
Neue Methode "on_packlist", wird aufgerufen wen der Inhalt der Paket-Liste sich ge�ndert hat.
View
@@ -3,6 +3,9 @@ Aktuelle Version auf: http://iroffer.dinoex.net/
With Version 3.28:
------------------
+386) CLEARRECORDS, CLEARGETS (suggested by Loke_AF)
+ Backup the statefile before clearing.
+
385) ruby_script (suggested by CreeW)
New method "on_packlist", called if the pack list has changed.
View
@@ -4831,6 +4831,8 @@ void a_cleargets(const userinput * const u)
{
xdcc *xd;
+ backup_statefile();
+
for (xd = irlist_get_head(&gdata.xdccs);
xd;
xd = irlist_get_next(xd)) {
View
@@ -2315,6 +2315,24 @@ void delayed_announce(void)
}
}
+void backup_statefile(void)
+{
+ char *statefile_tmp;
+ char *statefile_date;
+ int callval;
+
+ statefile_date = mycalloc(maxtextlengthshort);
+ getdatestr(statefile_date, 0, maxtextlengthshort);
+ statefile_tmp = mystrjoin(gdata.statefile, statefile_date, '.');
+ mydelete(statefile_date);
+ callval = rename(gdata.statefile, statefile_tmp);
+ if (callval < 0) {
+ outerror(OUTERROR_TYPE_WARN_LOUD, "Cant Save New State File '%s': %s",
+ gdata.statefile, strerror(errno));
+ }
+ mydelete(statefile_tmp);
+}
+
static magic_crc_t magic_crc_table[] = {
{ 0x24, 7, { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00, 0} },
{ 0x0E, 4, { 0x50, 0x4b, 0x03, 0x04, 0, 0, 0, 0 } },
View
@@ -80,6 +80,7 @@ char *new_logfilename(const char *logfile);
void expire_logfiles(const char *logfile);
int rotatelog(const char *logfile);
void delayed_announce(void);
+void backup_statefile(void);
ir_uint32 get_zip_crc32_pack(xdcc *xd);
View
@@ -2336,6 +2336,8 @@ static void u_clearrecords(const userinput * const u)
int ii;
updatecontext();
+ backup_statefile();
+
gdata.record = 0;
gdata.sentrecord = 0;
gdata.totalsent = 0;
View
@@ -20,6 +20,7 @@
#include "iroffer_headers.h"
#include "iroffer_globals.h"
#include "dinoex_utilities.h"
+#include "dinoex_jobs.h"
#include "dinoex_misc.h"
@@ -348,7 +349,6 @@ unsigned int read_statefile(void)
statefile_hdr_t *hdr;
ir_uint32 calluval;
unsigned int save = 0;
- int callval;
time_t timestamp = 0;
updatecontext();
@@ -478,20 +478,8 @@ unsigned int read_statefile(void)
snprintf(iroffer_now, maxtextlength, "iroffer-dinoex " VERSIONLONG ", %s", gdata.osstring);
if (strcmp(iroffer_version, iroffer_now) != 0)
{
- char *statefile_tmp;
- char *statefile_date;
++save;
- statefile_date = mycalloc(maxtextlengthshort);
- getdatestr(statefile_date, 0, maxtextlengthshort);
- statefile_tmp = mystrjoin(gdata.statefile, statefile_date, '.');
- mydelete(statefile_date);
- callval = rename(gdata.statefile, statefile_tmp);
- if (callval < 0)
- {
- outerror(OUTERROR_TYPE_WARN_LOUD, "Cant Save New State File '%s': %s",
- gdata.statefile, strerror(errno));
- }
- mydelete(statefile_tmp);
+ backup_statefile();
}
mydelete(iroffer_now);
}

0 comments on commit d33a505

Please sign in to comment.