From a7d7e3f128e15f282f2a96aba513823aa9603c22 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 12 Oct 2018 14:40:31 -0400 Subject: [PATCH] Removed ical_dezonify() from the citserver build ... it isn't used anymore --- citadel/Makefile.in | 4 +- citadel/config.c | 1 - citadel/default_timezone.c | 56 ++++ .../{ical_dezonify.h => default_timezone.h} | 1 - citadel/ical_dezonify.c | 247 ------------------ citadel/modules/calendar/serv_calendar.c | 72 +++-- citadel/modules/xmpp/serv_xmpp.c | 14 +- citadel/user_ops.c | 2 +- 8 files changed, 102 insertions(+), 295 deletions(-) create mode 100644 citadel/default_timezone.c rename citadel/{ical_dezonify.h => default_timezone.h} (53%) delete mode 100644 citadel/ical_dezonify.c diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 2546f52e0..9ec7b4f42 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -77,7 +77,7 @@ SOURCES=utils/citmail.c \ utillib/citadel_dirs.c \ citserver.c clientsocket.c config.c control.c $(DATABASE) \ domain.c serv_extensions.c genstamp.c \ - housekeeping.c ical_dezonify.c internet_addressing.c \ + housekeeping.c default_timezone.c internet_addressing.c \ locate_host.c auth.c msgbase.c parsedate.c \ room_ops.c euidindex.c server_main.c ldap.c \ support.c sysdep.c user_ops.c journaling.c threads.c \ @@ -132,7 +132,7 @@ SERV_OBJS = server_main.o utillib/citadel_dirs.o \ $(DATABASE:.c=.o) domain.o \ control.o config.o support.o room_ops.o \ msgbase.o euidindex.o \ - locate_host.o housekeeping.o ical_dezonify.o \ + locate_host.o housekeeping.o default_timezone.o \ internet_addressing.o journaling.o \ parsedate.o genstamp.o threads.o context.o \ clientsocket.o modules_init.o modules_upgrade.o $(SERV_MODULES) \ diff --git a/citadel/config.c b/citadel/config.c index 025b511d4..907d27fce 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -57,7 +57,6 @@ void validate_config(void) { config_warn_if_empty("c_aideroom"); config_warn_if_empty("c_twitroom"); config_warn_if_empty("c_nodename"); - config_warn_if_empty("c_default_cal_zone"); /* * Sanity check for port bindings diff --git a/citadel/default_timezone.c b/citadel/default_timezone.c new file mode 100644 index 000000000..6ce5c107e --- /dev/null +++ b/citadel/default_timezone.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 1987-2018 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 version 3. + * + * 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. + */ + + +#include "sysdep.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "citadel.h" +#include "server.h" +#include "citserver.h" +#include "sysdep_decls.h" +#include "support.h" +#include "config.h" +#include "default_timezone.h" +#include "ctdl_module.h" + + +/* + * Figure out which time zone needs to be used for timestamps that are + * not UTC and do not have a time zone specified. + */ +icaltimezone *get_default_icaltimezone(void) { + + icaltimezone *zone = NULL; + char *default_zone_name = CtdlGetConfigStr("c_default_cal_zone"); + + if (!zone) { + zone = icaltimezone_get_builtin_timezone(default_zone_name); + } + if (!zone) { + syslog(LOG_ERR, "ical: Unable to load '%s' time zone. Defaulting to UTC.", default_zone_name); + zone = icaltimezone_get_utc_timezone(); + } + if (!zone) { + syslog(LOG_ERR, "ical: unable to load UTC time zone!"); + } + + return zone; +} diff --git a/citadel/ical_dezonify.h b/citadel/default_timezone.h similarity index 53% rename from citadel/ical_dezonify.h rename to citadel/default_timezone.h index ccef82ba8..869c70ded 100644 --- a/citadel/ical_dezonify.h +++ b/citadel/default_timezone.h @@ -1,2 +1 @@ -void ical_dezonify(icalcomponent *cal); icaltimezone *get_default_icaltimezone(void); diff --git a/citadel/ical_dezonify.c b/citadel/ical_dezonify.c deleted file mode 100644 index 04d41e7c9..000000000 --- a/citadel/ical_dezonify.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Function to go through an ical component set and convert all non-UTC - * date/time properties to UTC. It also strips out any VTIMEZONE - * subcomponents afterwards, because they're irrelevant. - * - * Copyright (c) 1987-2017 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 version 3. - * - * 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. - */ - - -#include "sysdep.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "citadel.h" -#include "server.h" -#include "citserver.h" -#include "sysdep_decls.h" -#include "support.h" -#include "config.h" -#include "ical_dezonify.h" -#include "ctdl_module.h" - - -/* - * Figure out which time zone needs to be used for timestamps that are - * not UTC and do not have a time zone specified. - */ -icaltimezone *get_default_icaltimezone(void) { - - icaltimezone *zone = NULL; - char *default_zone_name = CtdlGetConfigStr("c_default_cal_zone"); - - if (!zone) { - zone = icaltimezone_get_builtin_timezone(default_zone_name); - } - if (!zone) { - syslog(LOG_ERR, "ical: Unable to load '%s' time zone. Defaulting to UTC.", default_zone_name); - zone = icaltimezone_get_utc_timezone(); - } - if (!zone) { - syslog(LOG_ERR, "ical: unable to load UTC time zone!"); - } - return zone; -} - - -/* - * Back end function for ical_dezonify() - * - * We supply this with the master component, the relevant component, - * and the property (which will be a DTSTART, DTEND, etc.) - * which we want to convert to UTC. - */ -void ical_dezonify_backend(icalcomponent *cal, - icalcomponent *rcal, - icalproperty *prop) { - - icaltimezone *t = NULL; - icalparameter *param; - const char *tzid = NULL; - struct icaltimetype TheTime; - int utc_declared_as_tzid = 0; /**< Component declared 'TZID=GMT' instead of using Z syntax */ - - /* Give me nothing and I will give you nothing in return. */ - if (cal == NULL) return; - - /* Hunt for a TZID parameter in this property. */ - param = icalproperty_get_first_parameter(prop, ICAL_TZID_PARAMETER); - - /* Get the stringish name of this TZID. */ - if (param != NULL) { - tzid = icalparameter_get_tzid(param); - - /* Convert it to an icaltimezone type. */ - if (tzid != NULL) { - /* syslog(LOG_DEBUG, " * Stringy supplied timezone is: '%s'\n", tzid); */ - if ( (!strcasecmp(tzid, "UTC")) || (!strcasecmp(tzid, "GMT")) ) { - utc_declared_as_tzid = 1; - /* syslog(LOG_DEBUG, " * ...and we handle that internally.\n"); */ - } - else { - /* try attached first */ - t = icalcomponent_get_timezone(cal, tzid); -/* - syslog(LOG_DEBUG, " * ...and I %s have tzdata for that zone.\n", - (t ? "DO" : "DO NOT") - ); -*/ - /* then try built-in timezones */ - if (!t) { - t = icaltimezone_get_builtin_timezone(tzid); -/* - if (t) { - syslog(LOG_DEBUG, " * Using system tzdata!\n"); - } -*/ - } - } - } - - } - - /* Now we know the timezone. Convert to UTC. */ - - if (icalproperty_isa(prop) == ICAL_DTSTART_PROPERTY) { - TheTime = icalproperty_get_dtstart(prop); - } - else if (icalproperty_isa(prop) == ICAL_DTEND_PROPERTY) { - TheTime = icalproperty_get_dtend(prop); - } - else if (icalproperty_isa(prop) == ICAL_DUE_PROPERTY) { - TheTime = icalproperty_get_due(prop); - } - else if (icalproperty_isa(prop) == ICAL_EXDATE_PROPERTY) { - TheTime = icalproperty_get_exdate(prop); - } - else { - return; - } - - /* syslog(LOG_DEBUG, " * Was: %s\n", icaltime_as_ical_string(TheTime)); */ - - if (icaltime_is_utc(TheTime)) { - /* syslog(LOG_DEBUG, " * This property is ALREADY UTC.\n"); */ - } - - else if (utc_declared_as_tzid) { - /* syslog(LOG_DEBUG, " * Replacing '%s' TZID with 'Z' suffix.\n", tzid); */ - TheTime.zone = icaltimezone_get_utc_timezone(); - } - - else { - /* Do the conversion. */ - if (t != NULL) { - /* syslog(LOG_DEBUG, " * Timezone prop found. Converting to UTC.\n"); */ - } - else { - /* syslog(LOG_DEBUG, " * Converting default timezone to UTC.\n"); */ - } - - if (t == NULL) { - t = get_default_icaltimezone(); - } - - icaltimezone_convert_time(&TheTime, - t, - icaltimezone_get_utc_timezone() - ); - TheTime.zone = icaltimezone_get_utc_timezone(); - } - - icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER); - /* syslog(LOG_DEBUG, " * Now: %s\n", icaltime_as_ical_string(TheTime)); */ - - /* Now add the converted property back in. */ - if (icalproperty_isa(prop) == ICAL_DTSTART_PROPERTY) { - icalproperty_set_dtstart(prop, TheTime); - } - else if (icalproperty_isa(prop) == ICAL_DTEND_PROPERTY) { - icalproperty_set_dtend(prop, TheTime); - } - else if (icalproperty_isa(prop) == ICAL_DUE_PROPERTY) { - icalproperty_set_due(prop, TheTime); - } - else if (icalproperty_isa(prop) == ICAL_EXDATE_PROPERTY) { - icalproperty_set_exdate(prop, TheTime); - } -} - - -/* - * Recursive portion of ical_dezonify() - */ -void ical_dezonify_recurse(icalcomponent *cal, icalcomponent *rcal) { - icalcomponent *c; - icalproperty *p; - - /* - * Recurse through all subcomponents *except* VTIMEZONE ones. - */ - for (c=icalcomponent_get_first_component( - rcal, ICAL_ANY_COMPONENT); - c != NULL; - c = icalcomponent_get_next_component( - rcal, ICAL_ANY_COMPONENT) - ) { - if (icalcomponent_isa(c) != ICAL_VTIMEZONE_COMPONENT) { - ical_dezonify_recurse(cal, c); - } - } - - /* - * Now look for DTSTART and DTEND properties - */ - for (p=icalcomponent_get_first_property(rcal, ICAL_ANY_PROPERTY); - p != NULL; - p = icalcomponent_get_next_property(rcal, ICAL_ANY_PROPERTY) - ) { - if ( - (icalproperty_isa(p) == ICAL_DTSTART_PROPERTY) - || (icalproperty_isa(p) == ICAL_DTEND_PROPERTY) - || (icalproperty_isa(p) == ICAL_DUE_PROPERTY) - || (icalproperty_isa(p) == ICAL_EXDATE_PROPERTY) - ) { - ical_dezonify_backend(cal, rcal, p); - } - } -} - - -/* - * Convert all DTSTART and DTEND properties in all subcomponents to UTC. - * This function will search any VTIMEZONE subcomponents to learn the - * relevant timezone information. - */ -void ical_dezonify(icalcomponent *cal) { - icalcomponent *vt = NULL; - - /* syslog(LOG_DEBUG, "ical_dezonify() started\n"); */ - - /* Convert all times to UTC */ - ical_dezonify_recurse(cal, cal); - - /* Strip out VTIMEZONE subcomponents -- we don't need them anymore */ - while (vt = icalcomponent_get_first_component( - cal, ICAL_VTIMEZONE_COMPONENT), vt != NULL) { - icalcomponent_remove_component(cal, vt); - icalcomponent_free(vt); - } - - /* syslog(LOG_DEBUG, "ical_dezonify() completed\n"); */ -} diff --git a/citadel/modules/calendar/serv_calendar.c b/citadel/modules/calendar/serv_calendar.c index 6c7071d4e..71c7fbc51 100644 --- a/citadel/modules/calendar/serv_calendar.c +++ b/citadel/modules/calendar/serv_calendar.c @@ -25,11 +25,10 @@ #include "serv_calendar.h" #include "room_ops.h" #include "euidindex.h" -#include "ical_dezonify.h" +#include "default_timezone.h" #include "config.h" - struct ical_respond_data { char desired_partnum[SIZ]; icalcomponent *cal; @@ -45,7 +44,7 @@ icalcomponent *icalcomponent_new_citadel_vcalendar(void) { encaps = icalcomponent_new_vcalendar(); if (encaps == NULL) { - syslog(LOG_CRIT, "ERROR: could not allocate component!\n"); + syslog(LOG_ERR, "calendar: could not allocate component"); return NULL; } @@ -84,8 +83,6 @@ icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp) { } - - /* * Write a calendar object into the specified user's calendar room. * If the supplied user is NULL, this function writes the calendar object @@ -190,13 +187,13 @@ void ical_send_a_reply(icalcomponent *request, char *action) { strcpy(summary_string, "Calendar item"); if (request == NULL) { - syslog(LOG_ERR, "ERROR: trying to reply to NULL event?\n"); + syslog(LOG_ERR, "calendar: trying to reply to NULL event"); return; } the_reply = icalcomponent_new_clone(request); if (the_reply == NULL) { - syslog(LOG_ERR, "ERROR: cannot clone request\n"); + syslog(LOG_ERR, "calendar: cannot clone request"); return; } @@ -598,13 +595,13 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) { /* Figure out just what event it is we're dealing with */ strcpy(uid, "--==<< InVaLiD uId >>==--"); ical_learn_uid_of_reply(uid, cal); - syslog(LOG_DEBUG, "UID of event being replied to is <%s>\n", uid); + syslog(LOG_DEBUG, "calendar: UID of event being replied to is <%s>", uid); strcpy(hold_rm, CC->room.QRname); /* save current room */ if (CtdlGetRoom(&CC->room, USERCALENDARROOM) != 0) { CtdlGetRoom(&CC->room, hold_rm); - syslog(LOG_CRIT, "cannot get user calendar room\n"); + syslog(LOG_ERR, "calendar: cannot get user calendar room"); return(2); } @@ -618,7 +615,7 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) { CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */ - syslog(LOG_DEBUG, "msgnum_being_replaced == %ld\n", msgnum_being_replaced); + syslog(LOG_DEBUG, "calendar: msgnum_being_replaced == %ld", msgnum_being_replaced); if (msgnum_being_replaced == 0) { return(1); /* no calendar event found */ } @@ -644,7 +641,7 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) { original_event = oec.c; if (original_event == NULL) { - syslog(LOG_ERR, "ERROR: Original_component is NULL.\n"); + syslog(LOG_ERR, "calendar: original_component is NULL"); return(2); } @@ -847,7 +844,7 @@ int ical_ctdl_is_overlap( return(1); } - /* syslog(LOG_DEBUG, "Comparing t1start %d:%d t1end %d:%d t2start %d:%d t2end %d:%d \n", + /* syslog(LOG_DEBUG, "Comparing t1start %d:%d t1end %d:%d t2start %d:%d t2end %d:%d", t1start.hour, t1start.minute, t1end.hour, t1end.minute, t2start.hour, t2start.minute, t2end.hour, t2end.minute); */ @@ -856,11 +853,11 @@ int ical_ctdl_is_overlap( /* If event 1 ends before event 2 starts, we're in the clear. */ if (icaltime_compare(t1end, t2start) <= 0) return(0); - /* syslog(LOG_DEBUG, "first passed\n"); */ + /* syslog(LOG_DEBUG, "calendar: first passed"); */ /* If event 2 ends before event 1 starts, we're also ok. */ if (icaltime_compare(t2end, t1start) <= 0) return(0); - /* syslog(LOG_DEBUG, "second passed\n"); */ + /* syslog(LOG_DEBUG, "calendar: second passed"); */ /* Otherwise, they overlap. */ return(1); @@ -1439,7 +1436,7 @@ void ical_freebusy(char *who) { if (found_user != 0) { strcpy(buf, who); recp = validate_recipients(buf, NULL, 0); - syslog(LOG_DEBUG, "Trying <%s>\n", buf); + syslog(LOG_DEBUG, "calendar: trying <%s>", buf); if (recp != NULL) { if (recp->num_local == 1) { found_user = CtdlGetUser(&usbuf, recp->recp_local); @@ -1453,7 +1450,7 @@ void ical_freebusy(char *who) { */ if (found_user != 0) { snprintf(buf, sizeof buf, "%s@%s", who, CtdlGetConfigStr("c_fqdn")); - syslog(LOG_DEBUG, "Trying <%s>\n", buf); + syslog(LOG_DEBUG, "calendar: trying <%s>", buf); recp = validate_recipients(buf, NULL, 0); if (recp != NULL) { if (recp->num_local == 1) { @@ -1476,7 +1473,7 @@ void ical_freebusy(char *who) { if ( (!strcasecmp(type, "localhost")) || (!strcasecmp(type, "directory")) ) { snprintf(buf, sizeof buf, "%s@%s", who, host); - syslog(LOG_DEBUG, "Trying <%s>\n", buf); + syslog(LOG_DEBUG, "calendar: trying <%s>", buf); recp = validate_recipients(buf, NULL, 0); if (recp != NULL) { if (recp->num_local == 1) { @@ -1505,11 +1502,10 @@ void ical_freebusy(char *who) { } /* Create a VFREEBUSY subcomponent */ - syslog(LOG_DEBUG, "Creating VFREEBUSY component\n"); + syslog(LOG_DEBUG, "calendar: creating VFREEBUSY component"); fb = icalcomponent_new_vfreebusy(); if (fb == NULL) { - cprintf("%d Internal error: cannot allocate memory.\n", - ERROR + INTERNAL_ERROR); + cprintf("%d Internal error: cannot allocate memory.\n", ERROR + INTERNAL_ERROR); CtdlGetRoom(&CC->room, hold_rm); return; } @@ -1532,7 +1528,7 @@ void ical_freebusy(char *who) { icalcomponent_add_property(fb, icalproperty_new_organizer(buf)); /* Add busy time from events */ - syslog(LOG_DEBUG, "Adding busy time from events\n"); + syslog(LOG_DEBUG, "calendar: adding busy time from events"); CtdlForEachMessage(MSGS_ALL, 0, NULL, NULL, NULL, ical_freebusy_backend, (void *)fb ); /* If values for DTSTART and DTEND are still not present, set them @@ -1546,7 +1542,7 @@ void ical_freebusy(char *who) { } /* Put the freebusy component into the calendar component */ - syslog(LOG_DEBUG, "Encapsulating\n"); + syslog(LOG_DEBUG, "calendar: encapsulating"); encaps = ical_encapsulate_subcomponent(fb); if (encaps == NULL) { icalcomponent_free(fb); @@ -1557,11 +1553,11 @@ void ical_freebusy(char *who) { } /* Set the method to PUBLISH */ - syslog(LOG_DEBUG, "Setting method\n"); + syslog(LOG_DEBUG, "calendar: setting method"); icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH); /* Serialize it */ - syslog(LOG_DEBUG, "Serializing\n"); + syslog(LOG_DEBUG, "calendar: serializing"); serialized_request = icalcomponent_as_ical_string_r(encaps); icalcomponent_free(encaps); /* Don't need this anymore. */ @@ -1669,7 +1665,7 @@ void ical_getics(void) encaps = icalcomponent_new_vcalendar(); if (encaps == NULL) { - syslog(LOG_ALERT, "ERROR: could not allocate component!\n"); + syslog(LOG_ERR, "calendar: could not allocate component!"); cprintf("%d Could not allocate memory\n", ERROR+INTERNAL_ERROR); return; } @@ -1795,7 +1791,7 @@ void ical_putics(void) HashPos = GetNewHashPos(tzidlist, 0); while (GetNextHashPos(tzidlist, HashPos, &len, &Key, &Value)) { - syslog(LOG_DEBUG, "Attaching timezone '%s'\n", (char*) Value); + syslog(LOG_DEBUG, "calendar: attaching timezone '%s'", (char*) Value); icaltimezone *t = NULL; /* First look for a timezone attached to the original calendar */ @@ -1920,7 +1916,7 @@ void ical_CtdlCreateRoom(void) /* Set expiration policy to manual; otherwise objects will be lost! */ if (CtdlGetRoomLock(&qr, USERCALENDARROOM)) { - syslog(LOG_CRIT, "Couldn't get the user calendar room!\n"); + syslog(LOG_ERR, "calendar: couldn't get the user calendar room"); return; } qr.QRep.expire_mode = EXPIRE_MANUAL; @@ -1937,7 +1933,7 @@ void ical_CtdlCreateRoom(void) /* Set expiration policy to manual; otherwise objects will be lost! */ if (CtdlGetRoomLock(&qr, USERTASKSROOM)) { - syslog(LOG_CRIT, "Couldn't get the user calendar room!\n"); + syslog(LOG_ERR, "calendar: couldn't get the user calendar room!"); return; } qr.QRep.expire_mode = EXPIRE_MANUAL; @@ -1954,7 +1950,7 @@ void ical_CtdlCreateRoom(void) /* Set expiration policy to manual; otherwise objects will be lost! */ if (CtdlGetRoomLock(&qr, USERNOTESROOM)) { - syslog(LOG_CRIT, "Couldn't get the user calendar room!\n"); + syslog(LOG_ERR, "calendar: couldn't get the user calendar room!"); return; } qr.QRep.expire_mode = EXPIRE_MANUAL; @@ -2003,7 +1999,7 @@ void ical_send_out_invitations(icalcomponent *top_level_cal, icalcomponent *cal) const char *tzidc = NULL; if (cal == NULL) { - syslog(LOG_ERR, "ERROR: trying to reply to NULL event?\n"); + syslog(LOG_ERR, "calendar: trying to reply to NULL event?"); return; } @@ -2021,7 +2017,7 @@ void ical_send_out_invitations(icalcomponent *top_level_cal, icalcomponent *cal) /* Clone the event */ the_request = icalcomponent_new_clone(cal); if (the_request == NULL) { - syslog(LOG_ERR, "ERROR: cannot clone calendar object\n"); + syslog(LOG_ERR, "calendar: cannot clone calendar object"); return; } @@ -2055,7 +2051,7 @@ void ical_send_out_invitations(icalcomponent *top_level_cal, icalcomponent *cal) } } - syslog(LOG_DEBUG, "<%d> attendees: <%s>\n", num_attendees, attendees_string); + syslog(LOG_DEBUG, "calendar: <%d> attendees: <%s>", num_attendees, attendees_string); /* If there are no attendees, there are no invitations to send, so... * don't bother putting one together! Punch out, Maverick! @@ -2068,7 +2064,7 @@ void ical_send_out_invitations(icalcomponent *top_level_cal, icalcomponent *cal) /* Encapsulate the VEVENT component into a complete VCALENDAR */ encaps = icalcomponent_new_vcalendar(); if (encaps == NULL) { - syslog(LOG_ALERT, "ERROR: could not allocate component!\n"); + syslog(LOG_ERR, "calendar: could not allocate component!"); icalcomponent_free(the_request); return; } @@ -2220,7 +2216,7 @@ void ical_saving_vevent(icalcomponent *top_level_cal, icalcomponent *cal) { icalproperty *organizer = NULL; char organizer_string[SIZ]; - syslog(LOG_DEBUG, "ical_saving_vevent() has been called!\n"); + syslog(LOG_DEBUG, "calendar: ical_saving_vevent() has been called"); /* Don't send out invitations unless the client wants us to. */ if (CIT_ICAL->server_generated_invitations == 0) { @@ -2332,7 +2328,7 @@ void ical_obj_beforesave_backend(char *name, char *filename, char *partnum, pch = icalproperty_get_comment(p); if (!IsEmptyStr(pch)) { CM_SetField(msg, eExclusiveID, pch, strlen(pch)); - syslog(LOG_DEBUG, "Saving calendar UID <%s>\n", pch); + syslog(LOG_DEBUG, "calendar: saving calendar UID <%s>", pch); } } @@ -2389,7 +2385,7 @@ int ical_obj_beforesave(struct CtdlMessage *msg, recptypes *recp) /* It must be an RFC822 message! */ if (msg->cm_format_type != 4) { - syslog(LOG_DEBUG, "Rejecting non-RFC822 message\n"); + syslog(LOG_DEBUG, "calendar: rejecting non-RFC822 message"); return(1); /* You tried to save a non-RFC822 message! */ } @@ -2563,12 +2559,12 @@ void ical_fixed_output(char *ptr, int len) { } - void serv_calendar_destroy(void) { icaltimezone_free_builtin_timezones(); } + /* * Register this module with the Citadel server. */ @@ -2599,7 +2595,7 @@ CTDL_MODULE_INIT(calendar) CtdlRegisterFixedOutputHook("application/ics", ical_fixed_output); CtdlRegisterCleanupHook(serv_calendar_destroy); } - + /* return our module name for the log */ return "calendar"; } diff --git a/citadel/modules/xmpp/serv_xmpp.c b/citadel/modules/xmpp/serv_xmpp.c index 3248a11cb..34c6e5d2e 100644 --- a/citadel/modules/xmpp/serv_xmpp.c +++ b/citadel/modules/xmpp/serv_xmpp.c @@ -57,6 +57,9 @@ #include "ctdl_module.h" #include "serv_xmpp.h" +/* uncomment for more verbosity - it will log all received XML tags */ +#define XMPP_XML_DEBUG + /* XML_StopParser is present in expat 2.x */ #if XML_MAJOR_VERSION > 1 #define HAVE_XML_STOPPARSER @@ -238,12 +241,12 @@ void xmpp_xml_start(void *data, const char *supplied_el, const char **attr) { strcpy(el, ++sep); } - /* +#ifdef XMPP_XML_DEBUG syslog(LOG_DEBUG, "xmpp: ELEMENT START: <%s>", el); for (i=0; attr[i] != NULL; i+=2) { syslog(LOG_DEBUG, "xmpp: Attribute '%s' = '%s'", attr[i], attr[i+1]); } - uncomment for more verbosity */ +#endif if (!strcasecmp(el, "stream")) { xmpp_stream_start(data, supplied_el, attr); @@ -310,12 +313,12 @@ void xmpp_xml_end(void *data, const char *supplied_el) { strcpy(el, ++sep); } - /* +#ifdef XMPP_XML_DEBUG syslog(LOG_DEBUG, "xmpp: ELEMENT END : <%s>", el); if (XMPP->chardata_len > 0) { syslog(LOG_DEBUG, "xmpp: chardata: %s", XMPP->chardata); } - uncomment for more verbosity */ +#endif if (!strcasecmp(el, "resource")) { if (XMPP->chardata_len > 0) { @@ -434,8 +437,9 @@ void xmpp_xml_end(void *data, const char *supplied_el) { else { cprintf("", xmlesc(xmlbuf, XMPP->iq_id, sizeof xmlbuf)); - cprintf("Don't know howto do '%s'!", xmlesc(xmlbuf, XMPP->iq_type, sizeof xmlbuf)); + cprintf("Don't know how to do '%s'!", xmlesc(xmlbuf, XMPP->iq_type, sizeof xmlbuf)); cprintf(""); + syslog(LOG_DEBUG, "XMPP: don't know how to do iq_type='%s' with iq_query_xmlns='%s'", XMPP->iq_type, XMPP->iq_query_xmlns); } /* Now clear these fields out so they don't get used by a future stanza */ diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 32af98e91..8548f8234 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -632,7 +632,7 @@ void do_login(void) /* If this user's name is the name of the system administrator * (as specified in setup), automatically assign access level 6. */ - if (!strcasecmp(CCC->user.fullname, CtdlGetConfigStr("c_sysadm"))) { + if ( (!IsEmptyStr(CtdlGetConfigStr("c_sysadm"))) && (!strcasecmp(CCC->user.fullname, CtdlGetConfigStr("c_sysadm"))) ) { CCC->user.axlevel = AxAideU; } -- 2.30.2