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 f624a48442c56c3d508c1b01f149de98f8b9d061..73a3d0f3f682270e99c28213202c77bcfbfd2a2b 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 2410047a4161dff7d4a2fe7a955afe0e7c154480..dcf5bfa927e83f03892a0a227685a89cdf54bd0f 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 abf8c4ef34c81f8549a738ed037473528a3ae058..c9c63f0eb8dd37a4a5a7f4960d1393f156f3db84 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 e068b8ef5f9011a1ad913611fdbca9ea7569a752..2eda2592210dfd88b0e774a7e32278ea6dcde8c3 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.206653 seconds and 4 git commands to generate.