Lines 172-221
get_attendee_if_attendee_sentby_is_user
Link Here
|
172 |
} |
172 |
} |
173 |
|
173 |
|
174 |
static char * |
174 |
static char * |
175 |
html_new_lines_for (char *string) |
175 |
html_new_lines_for (const char *string) |
176 |
{ |
176 |
{ |
177 |
char *html_string = (char *) malloc (sizeof (char)* (3500)); |
177 |
gchar **lines; |
178 |
int length = strlen (string); |
178 |
gchar *joined; |
179 |
int index = 0; |
|
|
180 |
char *index_ptr = string; |
181 |
char *temp = string; |
182 |
|
179 |
|
183 |
/*Find the first occurence*/ |
180 |
lines = g_strsplit_set (string, "\n", -1); |
184 |
index_ptr = strstr ((const char *)temp, "\n"); |
181 |
joined = g_strjoinv ("<br>", lines); |
|
|
182 |
g_strfreev (lines); |
185 |
|
183 |
|
186 |
/*Doesn't occur*/ |
184 |
return joined; |
187 |
if (index_ptr == NULL) { |
|
|
188 |
strcpy (html_string, (const char *)string); |
189 |
html_string[length] = '\0'; |
190 |
return html_string; |
191 |
} |
192 |
|
193 |
/*Split into chunks inserting <br> for \n */ |
194 |
do{ |
195 |
while (temp != index_ptr){ |
196 |
html_string[index++] = *temp; |
197 |
temp++; |
198 |
} |
199 |
temp++; |
200 |
|
201 |
html_string[index++] = '<'; |
202 |
html_string[index++] = 'b'; |
203 |
html_string[index++] = 'r'; |
204 |
html_string[index++] = '>'; |
205 |
|
206 |
index_ptr = strstr ((const char *)temp, "\n"); |
207 |
|
208 |
} while (index_ptr); |
209 |
|
210 |
/*Don't leave out the last chunk*/ |
211 |
while (*temp != '\0'){ |
212 |
html_string[index++] = *temp; |
213 |
temp++; |
214 |
} |
215 |
|
216 |
html_string[index] = '\0'; |
217 |
|
218 |
return html_string; |
219 |
} |
185 |
} |
220 |
|
186 |
|
221 |
char * |
187 |
char * |