Put(vcNames, LKEY(vf->cval), NewStrBufPlain(CKEY(vf->Name)),
HFreeStrBuf);
- syslog(LOG_DEBUG, "Token: %s -> %ld, %d",
- ChrPtr(name), vf->cval, inTokenCount);
+ syslog(LOG_DEBUG, "Token: %s -> %ld, %d", ChrPtr(name), vf->cval, inTokenCount);
}
}
StrBufAppendBufPlain(subStr, CKEY(vf[i].STR), 0);
if (layer == 0) {
- Put(VCTokenToDefine, CKEY(vf[i].STR), &vf[i],
- reference_free_handler);
+ Put(VCTokenToDefine, CKEY(vf[i].STR), &vf[i], reference_free_handler);
}
switch (vf[i].Type) {
case FlatString:
break;
case StringCluster:
{
- autoRegisterTokens(enumCounter, vf[i].Sub,
- subStr, 1, vf[i].cval);
+ autoRegisterTokens(enumCounter, vf[i].Sub, subStr, 1, vf[i].cval);
}
break;
case PhoneNumber:
TP->Tokens = Token;
searchFieldNo = GetTemplateTokenNumber(Target, TP, 0, 0);
if (searchFieldNo >= VCEnumCounter) {
- LogTemplateError(NULL, "VCardItem", ERR_PARM1, TP,
- "Invalid define");
+ LogTemplateError(NULL, "VCardItem", ERR_PARM1, TP, "Invalid define");
return 0;
}
return 1;
void *vItem;
long searchFieldNo = GetTemplateTokenNumber(Target, TP, 0, 0);
addrbookent *ab = (addrbookent *) CTX(CTX_VCARD);
- if (GetHash(ab->VC, LKEY(searchFieldNo), &vItem)
- && (vItem != NULL)) {
+ if (GetHash(ab->VC, LKEY(searchFieldNo), &vItem) && (vItem != NULL)) {
StrBufAppendTemplate(Target, TP, (StrBuf *) vItem, 1);
}
}
addrbookent *ab = (addrbookent *) CTX(CTX_VCARD);
if (t == NULL) {
- LogTemplateError(NULL, "VCard item", ERR_NAME, TP,
- "Missing context");
+ LogTemplateError(NULL, "VCard item", ERR_NAME, TP, "Missing context");
return;
}
if (GetHash(ab->VC, LKEY(t->cval), &vItem) && (vItem != NULL)) {
StrBufAppendTemplate(Target, TP, (StrBuf *) vItem, 0);
} else {
- LogTemplateError(NULL, "VCard item", ERR_NAME, TP,
- "Doesn't have that key - did you miss to filter in advance?");
+ LogTemplateError(NULL, "VCard item", ERR_NAME, TP, "Doesn't have that key - did you miss to filter in advance?");
}
}
void *vItem;
long searchFieldNo = GetTemplateTokenNumber(Target, TP, 0, 0);
/* todo: get descriptive string for this vcard type */
- if (GetHash(vcNames, LKEY(searchFieldNo), &vItem)
- && (vItem != NULL)) {
+ if (GetHash(vcNames, LKEY(searchFieldNo), &vItem) && (vItem != NULL)) {
StrBufAppendTemplate(Target, TP, (StrBuf *) vItem, 1);
} else {
LogTemplateError(NULL, "VCard item type", ERR_NAME, TP, "No i18n string for this.");
vcField *vf = (vcField *) Context;
memcpy(&type, key, sizeof(long));
- searchType =
- GetTemplateTokenNumber(Target, TP, IT_ADDT_PARAM(0), 0);
+ searchType = GetTemplateTokenNumber(Target, TP, IT_ADDT_PARAM(0), 0);
if (vf->Type == searchType) {
addrbookent *ab = (addrbookent *) CTX(CTX_VCARD);
- if (GetHash(ab->VC, LKEY(vf->cval), &v) && v != NULL)
+ if (GetHash(ab->VC, LKEY(vf->cval), &v) && v != NULL) {
return 1;
+ }
}
return rc;
}
if ((vf == NULL) || (ab == NULL)) {
LogTemplateError(NULL, "VCard item type", ERR_NAME, TP, "Need VCard and Vcard type in context");
-
return NULL;
}
return ab->VC;
const char *Key;
long len;
HashPos *it = GetNewHashPos(ab->VC, 0);
- while (GetNextHashPos(ab->VC, it, &len, &Key, &vVCitem) &&
- (vVCitem != NULL)) {
+ while (GetNextHashPos(ab->VC, it, &len, &Key, &vVCitem) && (vVCitem != NULL)) {
void *vvcField;
long type = 0;
memcpy(&type, Key, sizeof(long));
FlushStrBuf(thisVCToken);
is_qp = 0;
is_b64 = 0;
- syslog(LOG_DEBUG, "i: %d oneprop: %s - value: %s", i, v->prop[i].name, v->prop[i].value);
+ // syslog(LOG_DEBUG, "i: %d oneprop: %s - value: %s", i, v->prop[i].name, v->prop[i].value);
StrBufPlain(thisname, v->prop[i].name, -1);
StrBufLowerCase(thisname);
- extract_token(firsttoken, ChrPtr(thisname), 0, ';',
- sizeof firsttoken);
+ extract_token(firsttoken, ChrPtr(thisname), 0, ';', sizeof firsttoken);
ntokens = num_tokens(ChrPtr(thisname), ';');
for (j = 0, k = 0; j < ntokens && k < 10; ++j) {
- len =
- extract_token(buf, ChrPtr(thisname), j, ';',
- sizeof buf);
+ len = extract_token(buf, ChrPtr(thisname), j, ';', sizeof buf);
if (!strcasecmp(buf, "encoding=quoted-printable")) {
is_qp = 1;
} else if (!strcasecmp(buf, "encoding=base64")) {
(vField != NULL)) {
vcField *thisField = (vcField *) vField;
StrBuf *ThisFieldStr = NULL;
- syslog(LOG_DEBUG, "got this token: %s, found: %s", ChrPtr(thisVCToken), thisField->STR.Key);
+ // syslog(LOG_DEBUG, "got this token: %s, found: %s", ChrPtr(thisVCToken), thisField->STR.Key);
switch (thisField->Type) {
case StringCluster:{
int j = 0;
* to start with a blank card.
*/
void do_edit_vcard(long msgnum, char *partnum,
- message_summary * VCMsg,
- wc_mime_attachment * VCAtt,
- const char *return_to, const char *force_room)
-{
+ message_summary * VCMsg,
+ wc_mime_attachment * VCAtt,
+ const char *return_to, const char *force_room
+) {
WCTemplputParams SubTP;
wcsession *WCC = WC;
message_summary *Msg = NULL;
if (havebstr("force_room")) {
ForceRoom = sbstr("force_room");
if (gotoroom(ForceRoom) != 200) {
- AppendImportantMessage(_
- ("Unable to enter the room to save your message"),
- -1);
+ AppendImportantMessage(_ ("Unable to enter the room to save your message"), -1);
AppendImportantMessage(HKEY(": "));
AppendImportantMessage(SKEY(ForceRoom));
AppendImportantMessage(HKEY("; "));
AppendImportantMessage(_("Aborting."), -1);
- if (!strcmp
- (bstr("return_to"), "select_user_to_edit")) {
+ if (!strcmp(bstr("return_to"), "select_user_to_edit")) {
select_user_to_edit(NULL);
- } else
- if (!strcmp(bstr("return_to"), "do_welcome")) {
+ } else if (!strcmp(bstr("return_to"), "do_welcome")) {
do_welcome();
} else if (!IsEmptyStr(bstr("return_to"))) {
http_redirect(bstr("return_to"));
}
/* Make a vCard structure out of the data supplied in the form */
- StrBufPrintf(Buf, "begin:vcard\r\n%s\r\nend:vcard\r\n",
- bstr("extrafields")
- );
+ StrBufPrintf(Buf, "begin:vcard\r\n%s\r\nend:vcard\r\n", bstr("extrafields"));
v = VCardLoad(Buf); /* Start with the extra fields */
if (v == NULL) {
AppendImportantMessage(_("An error has occurred."), -1);
vcField *Sub;
FlushStrBuf(SubStr);
itSub = GetNewHashPos(DefineToToken, 0);
- while (GetNextHashPos
- (DefineToToken, itSub, &len, &Key, &pv)
- && (pv != NULL)) {
+ while (GetNextHashPos (DefineToToken, itSub, &len, &Key, &pv) && (pv != NULL)) {
Sub = (vcField *) pv;
if (Sub->parentCVal == t->cval) {
- if (StrLength(SubStr) > 0)
- StrBufAppendBufPlain
- (SubStr, HKEY(";"), 0);
-
-
-
- blen =
- snprintf(buf, sizeof(buf),
- "%ld", Sub->cval);
+ if (StrLength(SubStr) > 0) {
+ StrBufAppendBufPlain (SubStr, HKEY(";"), 0);
+ }
+ blen = snprintf(buf, sizeof(buf), "%ld", Sub->cval);
s = SSubBstr(postVcard, buf, blen);
-
- if ((s != NULL)
- && (StrLength(s) > 0)) {
+ if ((s != NULL) && (StrLength(s) > 0)) {
/// todo: utf8 qp
- StrBufAppendBuf(SubStr, s,
- 0);
+ StrBufAppendBuf(SubStr, s, 0);
}
}
}
s = sbstr("other_inetemail");
if (StrLength(s) > 0) {
FlushStrBuf(SubStr);
- while (StrBufSipLine(SubStr, s, &Pos),
- ((Pos != StrBufNOTNULL) && (Pos != NULL))) {
+ while (StrBufSipLine(SubStr, s, &Pos), ((Pos != StrBufNOTNULL) && (Pos != NULL))) {
if (StrLength(SubStr) > 0) {
- vcard_add_prop(v, "email;internet",
- ChrPtr(SubStr));
+ vcard_add_prop(v, "email;internet", ChrPtr(SubStr));
}
}
}
if (VS->is_singlecard != 1) {
VS->addrbook = NewHash(0, NULL);
if (oper == do_search) {
- snprintf(cmd, len, "MSGS SEARCH|%s",
- bstr("query"));
+ snprintf(cmd, len, "MSGS SEARCH|%s", bstr("query"));
} else {
strcpy(cmd, "MSGS ALL");
}
memset(&SubTP, 0, sizeof(WCTemplputParams));
StackContext(TP, &SubTP, abEntry, CTX_VCARD, 0, NULL);
- // No, don't display the name, it just shits all over the screen
- // FIXME AJC WORKING IN HERE RIGHT NOW
+ // ajc 2017mar08: not sure why this was here, it just writes in the wrong part of the screen
// DoTemplate(HKEY("vcard_list_name"), WCC->WBuf, &SubTP);
UnStackContext(&SubTP);
StrBufPlain(abEntry->name, _("(no name)"), -1);
}
+ syslog(LOG_DEBUG, "abEntry->name : %s", ChrPtr(abEntry->name));
+
vcard_free(v);
Put(VS->addrbook, SKEY(abEntry->name), abEntry, deleteAbEnt);
if (tablast > (num_ab - 1))
tablast = (num_ab - 1);
- headline =
- NewStrBufPlain(NULL,
- StrLength(v1) + StrLength(v2) + 10);
+ headline = NewStrBufPlain(NULL, StrLength(v1) + StrLength(v2) + 10);
if (GetHashAt(VS->addrbook, tabfirst, &hklen1, &c1, &v1)) {
a1 = (addrbookent *) v1;
StrBufAppendBuf(headline, a1->name, 0);
StrBuf_Utf8StrCut(headline, 3);
- if (GetHashAt
- (VS->addrbook, tablast, &hklen2, &c2, &v2)) {
-
+ if (GetHashAt(VS->addrbook, tablast, &hklen2, &c2, &v2)) {
a2 = (addrbookent *) v2;
- StrBufAppendBufPlain(headline, HKEY(" - "),
- 0);
+ StrBufAppendBufPlain(headline, HKEY(" - "), 0);
StrBufAppendBuf(headline, a2->name, 0);
StrBuf_Utf8StrCut(headline, 9);
}
}
-
-int vcard_RenderView_or_Tail(SharedMessageStatus * Stat,
- void **ViewSpecific, long oper)
+int vcard_RenderView_or_Tail(SharedMessageStatus * Stat, void **ViewSpecific, long oper)
{
const StrBuf *Mime;
vcardview_struct *VS;
VS = (vcardview_struct *) * ViewSpecific;
- if (VS->is_singlecard)
- read_message(WC->WBuf, HKEY("view_message"),
- lbstr("startmsg"), NULL, &Mime, NULL);
- else
+ if (VS->is_singlecard) {
+ read_message(WC->WBuf, HKEY("view_message"), lbstr("startmsg"), NULL, &Mime, NULL);
+ }
+ else {
do_addrbook_view(VS); /* Render the address book */
+ }
return 0;
}
VS = (vcardview_struct *) * ViewSpecific;
wDumpContent(1);
- if ((VS != NULL) && (VS->addrbook != NULL))
+ if ((VS != NULL) && (VS->addrbook != NULL)) {
DeleteHash(&VS->addrbook);
- if (VS != NULL)
+ }
+ if (VS != NULL) {
free(VS);
+ }
return 0;
}
-void render_MIME_VCard(StrBuf * Target, WCTemplputParams * TP,
- StrBuf * FoundCharset)
+void render_MIME_VCard(StrBuf * Target, WCTemplputParams * TP, StrBuf * FoundCharset)
{
- wc_mime_attachment *Mime =
- (wc_mime_attachment *) CTX(CTX_MIME_ATACH);
+ wc_mime_attachment *Mime = (wc_mime_attachment *) CTX(CTX_MIME_ATACH);
wcsession *WCC = WC;
- if (StrLength(Mime->Data) == 0)
+ if (StrLength(Mime->Data) == 0) {
MimeLoadData(Mime);
+ }
if (StrLength(Mime->Data) > 0) {
struct vCard *v;
StrBuf *Buf;
Buf = NewStrBuf();
/* If it's my vCard I can edit it */
- if ((!strcasecmp
- (ChrPtr(WCC->CurRoom.name), USERCONFIGROOM))
- || ((StrLength(WCC->CurRoom.name) > 11)
- &&
- (!strcasecmp
- (&(ChrPtr(WCC->CurRoom.name)[11]),
- USERCONFIGROOM)))
- || (WCC->CurRoom.view == VIEW_ADDRESSBOOK)
- ) {
+ if ( (!strcasecmp(ChrPtr(WCC->CurRoom.name), USERCONFIGROOM))
+ || ((StrLength(WCC->CurRoom.name) > 11)
+ && (!strcasecmp (&(ChrPtr(WCC->CurRoom.name)[11]), USERCONFIGROOM)))
+ || (WCC->CurRoom.view == VIEW_ADDRESSBOOK)
+ ) {
StrBufAppendPrintf(Buf,
"<a href=\"edit_vcard?msgnum=%ld?partnum=%s\">",
Mime->msgnum,
memset(&SubTP, 0, sizeof(WCTemplputParams));
StackContext(TP, &SubTP, &ab, CTX_VCARD, 0, NULL);
- DoTemplate(HKEY("vcard_msg_display"), Target,
- &SubTP);
+ DoTemplate(HKEY("vcard_msg_display"), Target, &SubTP);
UnStackContext(&SubTP);
DeleteHash(&ab.VC);
vcard_free(v);