Back to index

citadel  8.12
Functions
euidindex.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int DoesThisRoomNeedEuidIndexing (struct ctdlroom *qrbuf)
long locate_message_by_euid (char *euid, struct ctdlroom *qrbuf) __attribute__((deprecated))
void index_message_by_euid (char *euid, struct ctdlroom *qrbuf, long msgnum)
void rebuild_euid_index (void)
void cmd_euid (char *cmdbuf)

Function Documentation

void cmd_euid ( char *  cmdbuf)

Definition at line 224 of file euidindex.c.

                            {
       char euid[256];
       long msgnum;
        struct cdbdata *cdbfr;
        long *msglist = NULL;
        int num_msgs = 0;
       int i;

       if (CtdlAccessCheck(ac_logged_in_or_guest)) return;

       extract_token(euid, cmdbuf, 0, '|', sizeof euid);
       msgnum = CtdlLocateMessageByEuid(euid, &CC->room);
       if (msgnum <= 0L) {
              cprintf("%d not found\n", ERROR + MESSAGE_NOT_FOUND);
              return;
       }

        cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
       if (cdbfr != NULL) {
                num_msgs = cdbfr->len / sizeof(long);
                msglist = (long *) cdbfr->ptr;
                for (i = 0; i < num_msgs; ++i) {
                        if (msglist[i] == msgnum) {
                            cdb_free(cdbfr);
                            cprintf("%d %ld\n", CIT_OK, msgnum);
                            return;
                     }
              }
                cdb_free(cdbfr);
       }

       cprintf("%d not found\n", ERROR + MESSAGE_NOT_FOUND);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int DoesThisRoomNeedEuidIndexing ( struct ctdlroom qrbuf)

Definition at line 66 of file euidindex.c.

                                                         {

       switch(qrbuf->QRdefaultview) {
              case VIEW_BBS:              return(0);
              case VIEW_MAILBOX:   return(0);
              case VIEW_ADDRESSBOOK:      return(1);
              case VIEW_DRAFTS:       return(0);
              case VIEW_CALENDAR:  return(1);
              case VIEW_TASKS:     return(1);
              case VIEW_NOTES:     return(1);
              case VIEW_WIKI:             return(1);
              case VIEW_BLOG:             return(1);
       }
       
       return(0);
}

Here is the caller graph for this function:

void index_message_by_euid ( char *  euid,
struct ctdlroom qrbuf,
long  msgnum 
)

Definition at line 131 of file euidindex.c.

                                                                            {
       char *key;
       int key_len;
       char *data;
       int data_len;

       syslog(LOG_DEBUG, "Indexing message #%ld <%s> in <%s>\n", msgnum, euid, qrbuf->QRname);

       key_len = strlen(euid) + sizeof(long) + 1;
       key = malloc(key_len);
       memcpy(key, &qrbuf->QRnumber, sizeof(long));
       strcpy(&key[sizeof(long)], euid);

       data_len = sizeof(long) + key_len;
       data = malloc(data_len);

       memcpy(data, &msgnum, sizeof(long));
       memcpy(&data[sizeof(long)], key, key_len);

       cdb_store(CDB_EUIDINDEX, key, key_len, data, data_len);
       free(key);
       free(data);
}

Here is the call graph for this function:

Here is the caller graph for this function:

long locate_message_by_euid ( char *  euid,
struct ctdlroom qrbuf 
)

Definition at line 92 of file euidindex.c.

                                                                {
       return CtdlLocateMessageByEuid (euid, qrbuf);
}

Here is the call graph for this function:

void rebuild_euid_index ( void  )

Definition at line 213 of file euidindex.c.

                              {
       cdb_trunc(CDB_EUIDINDEX);          /* delete the old indices */
       CtdlForEachRoom(rebuild_euid_index_for_room, NULL);     /* enumerate rm names */
       rebuild_euid_index_for_room(NULL, NULL);  /* and index them */
}

Here is the call graph for this function:

Here is the caller graph for this function: