more information in json output (for mailing system)
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Thu, 11 Oct 2012 22:49:11 +0000 (22:49 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Thu, 11 Oct 2012 22:49:11 +0000 (22:49 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@204 251d49ef-1d17-4917-a970-b30cf55b089b

htmlandlogs.c
ipstruct.h
json.c
prometheus.c

index f624a48..73a3d0f 100644 (file)
@@ -225,8 +225,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
    }\r
    fprintf(f,"<td style=\"text-align: right\">%Lu</td>\n", ip->credit);\r
    fprintf(f,"<td style=\"text-align: right\"><span style=\"color:#%s\">%Lu</span></td>",\r
-             ip->keyword->html_color,\r
-             ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)));\r
+             ip->keyword->html_color, ip->realquota);\r
    fprintf(f,"<td style=\"text-align: right\">%s%Lu%s", f1, ip->traffic, f2);\r
 \r
    /* download --------------------------------------- */\r
index 2410047..dcf5bfa 100644 (file)
@@ -16,6 +16,7 @@ struct IP
  unsigned long long upload;\r
  unsigned long long traffic;\r
  unsigned long long credit;\r
+ unsigned long long realquota;\r
  unsigned long pktsup;\r
  unsigned long pktsdown;\r
  struct Keyword *keyword;\r
diff --git a/json.c b/json.c
index abf8c4e..c9c63f0 100644 (file)
--- a/json.c
+++ b/json.c
@@ -21,8 +21,11 @@ void write_json_traffic(char *json)
      {\r
       fprintf(f, ",\n");\r
      }\r
-     fprintf(f, " \"%s\":{ \"lms\": %d, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu, \"min\":%d, \"max\":%d, \"limit\":%d }",\r
-                ip->name, ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload, ip->min, ip->desired, ip->max);\r
+     fprintf(f, " \"%s\":{ \"lms\": %d, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu,\\r
+                  \"min\":%d, \"max\":%d, \"limit\":%d, \"realquota\":%Lu, \"credit\":%Lu, \"dailyquota\":%ld }",\r
+                ip->name, ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload, \r
+                ip->min, ip->desired, ip->max, ip->realquota, ip->credit, \r
+                (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)));\r
      jsoncount++;\r
     }\r
    }\r
index e068b8e..2eda259 100644 (file)
@@ -980,13 +980,14 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
     \r
     for_each(ip, ips) if(ip->min == group->min && ip->max > ip->min)\r
     {\r
-     if(    ip->keyword->data_limit && !ip->fixedprio \r
-         && (   ip->traffic>ip->credit\r
-              + (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))) )\r
+     ip->realquota=ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20));\r
+     if(     ip->keyword->data_limit \r
+         and not ip->fixedprio \r
+         and ip->traffic > ip->realquota )\r
      {\r
-      if(group_rate<ip->max)\r
+      if(group_rate < ip->max)\r
       {\r
-       ip->max=group_rate;\r
+       ip->max = group_rate;\r
       }\r
       group_rate+=magic_treshold;\r
       ip->prio=lowest_priority;\r
This page took 0.200119 seconds and 4 git commands to generate.