mailboxT *add_user_mailbox (userT *user, char *hostname, struct hostent *host, int port, char *alt_username) { int n; if (host == NULL) { // Need to lookup the stuffs // host = gethostbyjosh (hostname); } n = user->mailboxes++; user->mailbox[n].username[0] = '\0'; user->mailbox[n].host = host; strncpy (user->mailbox[n].hostname, hostname, MAX_HOSTNAME-1); user->mailbox[n].port = port; user->mailbox[n].up_to_date = 0; user->mailbox[n].messages = 0; user->mailbox[n].total_size = 0; user->mailbox[n].fd = -1; user->mailbox[n].message = NULL; if (alt_username != NULL) { strncpy (user->mailbox[n].username, alt_username, MAX_USERPASS-1); } if (SMUNGE_UIDL > 0) { char str[MAX_HOSTNAME+8]; if (alt_username != NULL) { snprintf (str, MAX_HOSTNAME+7, "%s%d%s", hostname, port, alt_username); } else { snprintf (str, MAX_HOSTNAME+7, "%s%d", hostname, port); } my_hash (str, user->mailbox[n].uidl_hash, 2); } return (&user->mailbox[n]); }
static size_t hash(const Kmer& a) { return my_hash(a); }
int hash_func(hash_t hash, hash_element_t e){ return my_hash(hash->size, e); }