/*
- * $Id$
+ * Copyright (c) 1996-2011 by the citadel.org team
+ *
+ * This program is open source software. You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "webcit.h"
void select_user_to_edit(const char *preselect)
{
output_headers(1, 0, 0, 0, 1, 0);
- do_template("edituser_select", NULL);
+ do_template("aide_edituser_select");
end_burst();
}
{
int Done = 0;
CompareFunc SortIt;
- HashList *Hash;
+ HashList *Hash = NULL;
StrBuf *Buf;
UserListEntry* ul;
char nnn[64];
while (!Done) {
len = StrBuf_ServGetln(Buf);
- if ((len == 3) &&
- (strcmp(ChrPtr(Buf), "000")==0)) {
+ if ((len <0) ||
+ ((len == 3) &&
+ !strcmp(ChrPtr(Buf), "000")))
+ {
Done = 1;
break;
}
SortByPayload(Hash, SortIt);
else
SortByPayload(Hash, CompareUID);
- return Hash;
}
FreeStrBuf(&Buf);
- return NULL;
+ return Hash;
}
int ConditionalUserAccess(StrBuf *Target, WCTemplputParams *TP)
{
UserListEntry *ul = (UserListEntry*) CTX;
-
- if (TP->Tokens->Params[3]->Type == TYPE_LONG)
- return (TP->Tokens->Params[3]->lvalue == ul->AccessLevel);
- else
+
+ if (ul == NULL)
return 0;
+
+ return GetTemplateTokenNumber(Target,
+ TP,
+ 3,
+ AxNewU)
+ ==
+ ul->AccessLevel;
}
/*
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, NULL) > 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);
- if (GetServerStatus(Buf, NULL) != 4) {
+ if (GetServerStatus(Buf, NULL) == 4) {
serv_puts("Content-type: text/x-vcard");
serv_puts("");
serv_puts("begin:vcard");
serv_puts("end:vcard");
serv_puts("000");
}
+ else
+ syslog(1, "Error while creating user vcard: %s\n", ChrPtr(Buf));
goto TRYAGAIN;
}
FreeStrBuf(&Buf);
SubTP.Filter.ContextType = CTX_USERLIST;
SubTP.Context = UL;
output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(HKEY("userlist_detailview"), NULL, &SubTP);
+ DoTemplate(HKEY("aide_edituser_detailview"), NULL, &SubTP);
end_burst();
}
DeleteUserListEntry(UL);
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);
GroupchangenPosts,
CTX_USERLIST);
+ REGISTERTokenParamDefine(AxDeleted);
+ REGISTERTokenParamDefine(AxNewU);
+ REGISTERTokenParamDefine(AxProbU);
+ REGISTERTokenParamDefine(AxLocU);
+ REGISTERTokenParamDefine(AxNetU);
+ REGISTERTokenParamDefine(AxPrefU);
+ REGISTERTokenParamDefine(AxAideU);
}
+