Ticket #484 (new defect)

Opened 7 years ago

Last modified 6 years ago

[PATCH] patch for plugin-sunbird-022 to support multi-line ical fields

Reported by: darbrew2000@… Owned by: abauer
Priority: normal Milestone:
Component: Plugin: mozilla Version: 0.22
Severity: normal Keywords:
Cc:

Description

Great plugin, but as of 0.22, the sunbird plugin couldn't handle multiline ical fields, e.g.,:

UID:

23493984794328745 98432798734

Here's a patch to handle this.

--- src/tools.c 2007-03-27 06:49:54.000000000 -0500
+++ /home/buntinas/sources/opensync/libopensync-plugin-sunbird-0.22/src/tools.c 2007-04-20 17:03:30.000000000 -0500
@@ -187,8 +187,35 @@
         
     while (!feof(f))
     {
-        if (!fgets(buf, buf_size, f))
+        size_t offset = 0;
+        char *bptr = buf;
+
+        if (!fgets(bptr, buf_size - offset, f))
             break;
+            
+        while (1)
+        {  
+            char cont_char;
+
+            cont_char = fgetc(f);
+            if (cont_char == ' ' || cont_char == '\t')
+            {
+                len = strlen(bptr);
+                while (len > 0 && (bptr[len-1] == '\n' || bptr[len-1] == '\r'))
+                    --len;
+                
+                offset += len;
+                bptr += len;
+            }
+            else if (cont_char != EOF)
+            {
+                ungetc(cont_char, f);
+                break;
+            }
+            
+            if (!fgets(bptr, buf_size - offset, f))
+                break;
+        }
 
         len = strlen(buf);
         while (len > 0 && (buf[len-1] == '\n' || buf[len-1] == '\r'))

Change History

comment:2 Changed 7 years ago by dgollub

  • Component changed from OpenSync to Plugin: sunbird

comment:3 Changed 6 years ago by felixmoeller

  • Summary changed from patch for plugin-sunbird-022 to support multi-line ical fields to [PATCH] patch for plugin-sunbird-022 to support multi-line ical fields
Note: See TracTickets for help on using tickets.