void *vMsg;
message_summary *Msg;
wc_mime_attachment *Att;
-
int Done;
StrBuf *Buf;
long vcard_msgnum = (-1L);
int already_tried_creating_one = 0;
StrBuf *FoundCharset = NewStrBuf();
StrBuf *Error = NULL;
-
+ SharedMessageStatus Stat;
+
+
Buf = NewStrBuf();
TRYAGAIN:
+ memset(&Stat, 0, sizeof(SharedMessageStatus));
+ Stat.maxload = 10000;
+ Stat.lowest_found = (-1);
+ Stat.highest_found = (-1);
Done = 0;
- /** Search for the user's vCard */
- if (load_msg_ptrs("MSGS ALL||||1", 1) > 0) {
+ /* Search for the user's vCard */
+ if (load_msg_ptrs("MSGS ALL||||1", &Stat) > 0) {
at = GetNewHashPos(WCC->summ, 0);
while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
Msg = (message_summary*) vMsg;
if (Msg->AllAttach != NULL) {
att = GetNewHashPos(Msg->AllAttach, 0);
- while (GetNextHashPos(Msg->AllAttach, att, &HKLen, &HashKey, &vMsg)) {
+ while (GetNextHashPos(Msg->AllAttach, att, &HKLen, &HashKey, &vMsg) &&
+ (vcard_msgnum == -1)) {
Att = (wc_mime_attachment*) vMsg;
if (
(strcasecmp(ChrPtr(Att->ContentType), "text/x-vcard") == 0)
) {
*VCAtt = Att;
*VCMsg = Msg;
+ vcard_msgnum = Msg->msgnum;
if (Att->Data == NULL) {
MimeLoadData(Att);
}
}
}
+ DeleteHashPos(&att);
}
FreeStrBuf(&Error); /* don't care... */
}
DeleteHashPos(&at);
}
+
/* If there's no vcard, create one */
if ((*VCMsg == NULL) && (already_tried_creating_one == 0)) {
+ FlushStrBuf(Buf);
already_tried_creating_one = 1;
serv_puts("ENT0 1|||4");
StrBuf_ServGetln(Buf);
serv_puts("end:vcard");
serv_puts("000");
}
+ else
+ lprintf(1, "Error while creating user vcard: %s\n", ChrPtr(Buf));
goto TRYAGAIN;
}
FreeStrBuf(&Buf);
InitModule_USEREDIT
(void)
{
- WebcitAddUrlHandler(HKEY("select_user_to_edit"), _select_user_to_edit, 0);
- WebcitAddUrlHandler(HKEY("display_edituser"), _display_edituser, 0);
- WebcitAddUrlHandler(HKEY("edituser"), edituser, 0);
- WebcitAddUrlHandler(HKEY("create_user"), create_user, 0);
-
- RegisterNamespace("USERLIST:USERNAME", 0, 1, tmplput_USERLIST_UserName, CTX_USERLIST);
- RegisterNamespace("USERLIST:PASSWD", 0, 1, tmplput_USERLIST_Password, CTX_USERLIST);
- RegisterNamespace("USERLIST:ACCLVLNO", 0, 0, tmplput_USERLIST_AccessLevelNo, CTX_USERLIST);
- RegisterNamespace("USERLIST:ACCLVLSTR", 0, 0, tmplput_USERLIST_AccessLevelStr, CTX_USERLIST);
- RegisterNamespace("USERLIST:UID", 0, 0, tmplput_USERLIST_UID, CTX_USERLIST);
- RegisterNamespace("USERLIST:LASTLOGON:STR", 0, 0, tmplput_USERLIST_LastLogonStr, CTX_USERLIST);
- RegisterNamespace("USERLIST:LASTLOGON:NO", 0, 0, tmplput_USERLIST_LastLogonNo, CTX_USERLIST);
- RegisterNamespace("USERLIST:NLOGONS", 0, 0, tmplput_USERLIST_nLogons, CTX_USERLIST);
- RegisterNamespace("USERLIST:NPOSTS", 0, 0, tmplput_USERLIST_nPosts, CTX_USERLIST);
+ WebcitAddUrlHandler(HKEY("select_user_to_edit"), "", 0, _select_user_to_edit, 0);
+ WebcitAddUrlHandler(HKEY("display_edituser"), "", 0, _display_edituser, 0);
+ WebcitAddUrlHandler(HKEY("edituser"), "", 0, edituser, 0);
+ WebcitAddUrlHandler(HKEY("create_user"), "", 0, create_user, 0);
+
+ RegisterNamespace("USERLIST:USERNAME", 0, 1, tmplput_USERLIST_UserName, NULL, CTX_USERLIST);
+ RegisterNamespace("USERLIST:PASSWD", 0, 1, tmplput_USERLIST_Password, NULL, CTX_USERLIST);
+ RegisterNamespace("USERLIST:ACCLVLNO", 0, 0, tmplput_USERLIST_AccessLevelNo, NULL, CTX_USERLIST);
+ RegisterNamespace("USERLIST:ACCLVLSTR", 0, 0, tmplput_USERLIST_AccessLevelStr, NULL, CTX_USERLIST);
+ RegisterNamespace("USERLIST:UID", 0, 0, tmplput_USERLIST_UID, NULL, CTX_USERLIST);
+ RegisterNamespace("USERLIST:LASTLOGON:STR", 0, 0, tmplput_USERLIST_LastLogonStr, NULL, CTX_USERLIST);
+ RegisterNamespace("USERLIST:LASTLOGON:NO", 0, 0, tmplput_USERLIST_LastLogonNo, NULL, CTX_USERLIST);
+ RegisterNamespace("USERLIST:NLOGONS", 0, 0, tmplput_USERLIST_nLogons, NULL, CTX_USERLIST);
+ RegisterNamespace("USERLIST:NPOSTS", 0, 0, tmplput_USERLIST_nPosts, NULL, CTX_USERLIST);
- RegisterNamespace("USERLIST:FLAGS", 0, 0, tmplput_USERLIST_Flags, CTX_USERLIST);
- RegisterNamespace("USERLIST:DAYSTILLPURGE", 0, 0, tmplput_USERLIST_DaysTillPurge, CTX_USERLIST);
+ RegisterNamespace("USERLIST:FLAGS", 0, 0, tmplput_USERLIST_Flags, NULL, CTX_USERLIST);
+ RegisterNamespace("USERLIST:DAYSTILLPURGE", 0, 0, tmplput_USERLIST_DaysTillPurge, NULL, CTX_USERLIST);
RegisterConditional(HKEY("COND:USERNAME"), 0, ConditionalUser, CTX_USERLIST);
RegisterConditional(HKEY("COND:USERACCESS"), 0, ConditionalUserAccess, CTX_USERLIST);