Example #1
0
 protected void handleLine(String line, BufferedReader reader) throws IOException {
   // skip empty lines
   if (line.length() > 0) {
     VProperty property = new VProperty(line);
     // inner object
     if ("BEGIN".equals(property.getKey())) {
       addVObject(new VObject(property, reader));
     } else if (property.getKey() != null) {
       addProperty(property);
     }
   }
 }
Example #2
0
 /**
  * Set vProperty value on vObject, remove property if value is null.
  *
  * @param name property name
  * @param value property value
  */
 public void setPropertyValue(String name, String value) {
   if (value == null) {
     removeProperty(name);
   } else {
     VProperty property = getProperty(name);
     if (property == null) {
       property = new VProperty(name, value);
       addProperty(property);
     } else {
       property.setValue(value);
     }
   }
 }
  protected void fixAlarm(VObject vObject, boolean fromServer) {
    if (vObject.vObjects != null) {
      if (Settings.getBooleanProperty("davmail.caldavDisableReminders", false)) {
        ArrayList<VObject> vAlarms = null;
        for (VObject vAlarm : vObject.vObjects) {
          if ("VALARM".equals(vAlarm.type)) {
            if (vAlarms == null) {
              vAlarms = new ArrayList<VObject>();
            }
            vAlarms.add(vAlarm);
          }
        }
        // remove all vAlarms
        if (vAlarms != null) {
          for (VObject vAlarm : vAlarms) {
            vObject.vObjects.remove(vAlarm);
          }
        }

      } else {
        for (VObject vAlarm : vObject.vObjects) {
          if ("VALARM".equals(vAlarm.type)) {
            String action = vAlarm.getPropertyValue("ACTION");
            if (fromServer
                && "DISPLAY".equals(action)
                // convert DISPLAY to AUDIO only if user defined an alarm sound
                && Settings.getProperty("davmail.caldavAlarmSound") != null) {
              // Convert alarm to audio for iCal
              vAlarm.setPropertyValue("ACTION", "AUDIO");

              if (vAlarm.getPropertyValue("ATTACH") == null) {
                // Add defined sound into the audio alarm
                VProperty vProperty =
                    new VProperty("ATTACH", Settings.getProperty("davmail.caldavAlarmSound"));
                vProperty.addParam("VALUE", "URI");
                vAlarm.addProperty(vProperty);
              }

            } else if (!fromServer && "AUDIO".equals(action)) {
              // Use the alarm action that exchange (and blackberry) understand
              // (exchange and blackberry don't understand audio actions)
              vAlarm.setPropertyValue("ACTION", "DISPLAY");
            }
          }
        }
      }
    }
  }
 protected void splitExDate(VObject vObject) {
   List<VProperty> exDateProperties = vObject.getProperties("EXDATE");
   if (exDateProperties != null) {
     for (VProperty property : exDateProperties) {
       String value = property.getValue();
       if (value.indexOf(',') >= 0) {
         // split property
         vObject.removeProperty(property);
         for (String singleValue : value.split(",")) {
           VProperty singleProperty = new VProperty("EXDATE", singleValue);
           singleProperty.setParams(property.getParams());
           vObject.addProperty(singleProperty);
         }
       }
     }
   }
 }
Example #5
0
 /**
  * Add vProperty value on vObject.
  *
  * @param name property name
  * @param value property value
  */
 public void addPropertyValue(String name, String value) {
   if (value != null) {
     VProperty property = new VProperty(name, value);
     addProperty(property);
   }
 }
 /**
  * Add property on first VEVENT.
  *
  * @param vProperty property object
  */
 public void addFirstVeventProperty(VProperty vProperty) {
   firstVevent.addProperty(vProperty);
 }