]> andersk Git - moira.git/blobdiff - server/qfollow.pc
Command line printer manipulation client, and build goo.
[moira.git] / server / qfollow.pc
index 3b6becbd75f929d1d34ee282d079af7767823ced..480d287fc72e8c9d8fa5e1d11eb126f6b66a8125 100644 (file)
@@ -42,12 +42,16 @@ EXEC SQL WHENEVER SQLERROR DO dbmserr();
 int set_modtime(struct query *q, char *argv[], client *cl)
 {
   char *name, *entity, *table;
-  int who;
+  int who, row = 0;
 
   entity = cl->entity;
   who = cl->client_id;
   table = table_name[q->rtable];
-  name = argv[0];
+
+  if (q->type == MR_Q_UPDATE)
+    row = 1;
+
+  name = argv[0 + row];
 
   sprintf(stmt_buf, "UPDATE %s SET modtime = SYSDATE, modby = %d, "
          "modwith = '%s' WHERE name = '%s'", table, who, entity, name);
@@ -394,7 +398,7 @@ int followup_gpob(struct query *q, struct save_queue *sq, struct validate *v,
   char *ptype, *p;
   int mid, sid, status, i;
   EXEC SQL BEGIN DECLARE SECTION;
-  int users_id, pid, iid, bid;
+  int users_id, pid, iid, bid, eid;
   char mach[MACHINE_NAME_SIZE], fs[FILESYS_LABEL_SIZE];
   char str[STRINGS_STRING_SIZE];
   EXEC SQL END DECLARE SECTION;
@@ -406,7 +410,7 @@ int followup_gpob(struct query *q, struct save_queue *sq, struct validate *v,
       ptype = argv[1];
       users_id = atoi(argv[2]);
 
-      EXEC SQL SELECT pop_id, imap_id, box_id INTO :pid, :iid, :bid
+      EXEC SQL SELECT pop_id, imap_id, box_id, exchange_id INTO :pid, :iid, :bid, :eid
        FROM users WHERE users_id = :users_id;
       if (sqlca.sqlcode)
        return MR_USER;
@@ -421,7 +425,7 @@ int followup_gpob(struct query *q, struct save_queue *sq, struct validate *v,
 
          /* If SMTP, don't bother fetching IMAP and POP boxes. */
          if (ptype[1] == 'M')
-           pid = iid = 0;
+           pid = iid = eid = 0;
        }
       if (iid)
        {
@@ -440,12 +444,20 @@ int followup_gpob(struct query *q, struct save_queue *sq, struct validate *v,
          if (sqlca.sqlcode)
            return MR_MACHINE;
        }
+      if (eid)
+       {
+         /* EXCHANGE, or SPLIT with EXCHANGE */
+         EXEC SQL SELECT m.name INTO :mach FROM machine m, users u
+           WHERE u.users_id = :users_id AND u.exchange_id = m.mach_id;
+         if (sqlca.sqlcode)
+           return MR_MACHINE;
+       }
 
       free(argv[2]);
       free(argv[3]);
 
       /* Now assemble the right answer. */
-      if (!strcmp(ptype, "POP"))
+      if (!strcmp(ptype, "POP") || !strcmp(ptype, "EXCHANGE"))
        {
          argv[2] = xstrdup(strtrim(mach));
          argv[3] = xmalloc(strlen(argv[0]) + strlen(argv[2]) + 2);
@@ -614,13 +626,16 @@ int followup_glin(struct query *q, struct save_queue *sq, struct validate *v,
       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 (q->version > 3)
+       {
+         if (q->version < 10)
+           status = fix_ace(argv[10], &argv[11]);
+         else if (q->version >= 10)
+           status = fix_ace(argv[12], &argv[13]); 
       
-      if (status && status != MR_NO_MATCH)
-       return status;
+         if (status && status != MR_NO_MATCH)
+           return status;
+       }
 
       if (atoi(argv[6]) == -1)
        {
@@ -805,7 +820,7 @@ int followup_aqot(struct query *q, char *argv[], client *cl)
    * conflicts between what is possible in the query table and what
    * is possible in SQL.
    */
-  if (q->type == APPEND)
+  if (q->type == MR_Q_APPEND)
     {
       incremental_clear_before();
       EXEC SQL INSERT INTO quota
@@ -824,7 +839,7 @@ int followup_aqot(struct query *q, char *argv[], client *cl)
 
   if (dbms_errno)
     return mr_errcode;
-  if (q->type == APPEND)
+  if (q->type == MR_Q_APPEND)
     {
       EXEC SQL UPDATE tblstats SET appends = appends + 1, modtime = SYSDATE
        WHERE table_name = :tname;
@@ -1042,6 +1057,13 @@ int followup_get_user(struct query *q, struct save_queue *sq, struct
       if (status && status != MR_NO_MATCH)
        return status;
 
+      if (q->version > 11)
+       {
+         status = fix_ace(argv[15], &argv[16]);
+         if (status && status != MR_NO_MATCH)
+           return status;
+       }
+
       (*action)(q->vcnt, argv, actarg);
       for (k = 0; k < q->vcnt; k++)
        free(argv[k]);
@@ -1050,7 +1072,3 @@ int followup_get_user(struct query *q, struct save_queue *sq, struct
   sq_destroy(sq);
   return MR_SUCCESS;
 }
-
-
-
-
This page took 0.056646 seconds and 4 git commands to generate.