]> andersk Git - moira.git/blobdiff - server/qfollow.pc
Revert incremental code until we actually have an incremental (not yet)
[moira.git] / server / qfollow.pc
index 09a9d1af4629e8f81538e8c4a2cc289bb4e63c29..3b6becbd75f929d1d34ee282d079af7767823ced 100644 (file)
@@ -526,13 +526,18 @@ int followup_gsnt(struct query *q, struct save_queue *sq, struct validate *v,
                  client *cl)
 {
   char **argv;
-  int status;
+  int status, idx;
+
+  if (q->version < 8)
+    idx = 0;
+  else
+    idx = 3;
 
   while (sq_get_data(sq, &argv))
     {
       mr_trim_args(q->vcnt, argv);
 
-      status = fix_ace(argv[7], &argv[8]);
+      status = fix_ace(argv[7 + idx], &argv[8 + idx]);
       if (status && status != MR_NO_MATCH)
        return status;
     }
@@ -552,8 +557,10 @@ int followup_ghst(struct query *q, struct save_queue *sq, struct validate *v,
 
   if (q->version < 6)
     idx = 0;
-  else
+  else if (q->version >= 6 && q->version < 8)
     idx = 1;
+  else
+    idx = 2;
 
   while (sq_get_data(sq, &argv))
     {
@@ -599,16 +606,21 @@ int followup_glin(struct query *q, struct save_queue *sq, struct validate *v,
 
       if (q->version == 2)
        status = fix_ace(argv[7], &argv[8]);
-      else 
+      else if (q->version > 2 && q->version < 10)
        status = fix_ace(argv[8], &argv[9]);
+      else
+       status = fix_ace(argv[10], &argv[11]);
+
+      if (status && status != MR_NO_MATCH)
+       return status;
+
+      if (q->version > 3 && q->version < 10)
+       status = fix_ace(argv[10], &argv[11]);
+      else 
+       status = fix_ace(argv[12], &argv[13]); 
+      
       if (status && status != MR_NO_MATCH)
        return status;
-      if (q->version > 3)
-       {
-         status = fix_ace(argv[10], &argv[11]);
-         if (status && status != MR_NO_MATCH)
-           return status;
-       }
 
       if (atoi(argv[6]) == -1)
        {
@@ -975,17 +987,20 @@ int followup_gcon(struct query *q, struct save_queue *sq, struct validate *v,
                  client *cl)
 {
   char **argv;
-  int status;
+  int status, idx = 0;
+
+  if (q->version >= 9)
+    idx = 1;
 
   while (sq_get_data(sq, &argv))
   {
     mr_trim_args(q->vcnt, argv);
 
-    status = fix_ace(argv[4], &argv[5]);
+    status = fix_ace(argv[4 + idx], &argv[5 + idx]);
     if (status && status != MR_NO_MATCH)
            return status;
       
-         status = fix_ace(argv[6], &argv[7]);
+         status = fix_ace(argv[6 + idx], &argv[7 + idx]);
          if (status && status != MR_NO_MATCH)
            return status;
        }
@@ -993,3 +1008,49 @@ int followup_gcon(struct query *q, struct save_queue *sq, struct validate *v,
   return followup_fix_modby(q, sq, v, action, actarg, cl);
 }
 
+/* followup_get_user:  fix the modby and creator.
+ * This assumes that the modby and creator fields are always 
+ * in the same relative position in the argv.
+ */
+
+int followup_get_user(struct query *q, struct save_queue *sq, struct 
+                     validate *v, int (*action)(int, char *[], void *),
+                     void *actarg, client *cl)
+{
+  char **argv;
+  int i, j, k, status, id;
+
+  i = q->vcnt - 4;
+  j = q->vcnt - 1;
+  while (sq_get_data(sq, &argv))
+    {
+      mr_trim_args(q->vcnt, argv);
+
+      id = atoi(argv[i]);
+      if (id > 0)
+       status = id_to_name(id, USERS_TABLE, &argv[i]);
+      else
+       status = id_to_name(-id, STRINGS_TABLE, &argv[i]);
+      if (status && status != MR_NO_MATCH)
+       return status;
+
+      id = atoi(argv[j]);
+      if (id > 0)
+       status = id_to_name(id, USERS_TABLE, &argv[j]);
+      else
+       status = id_to_name(-id, STRINGS_TABLE, &argv[j]);
+      if (status && status != MR_NO_MATCH)
+       return status;
+
+      (*action)(q->vcnt, argv, actarg);
+      for (k = 0; k < q->vcnt; k++)
+       free(argv[k]);
+      free(argv);
+    }
+  sq_destroy(sq);
+  return MR_SUCCESS;
+}
+
+
+
+
This page took 0.037539 seconds and 4 git commands to generate.