Update of /cvsroot/gaim/gaim/src
In directory usw-pr-cvs1:/tmp/cvs-serv22686
Modified Files:
gaim.h util.c
Log Message:
i shouldn't have modified gaim.h like i did. *slaps own wrists* Do as I say, not as I do.
Index: gaim.h
===================================================================
RCS file: /cvsroot/gaim/gaim/src/gaim.h,v
retrieving revision 1.288
retrieving revision 1.289
diff -u -d -r1.288 -r1.289
--- gaim.h 2001/10/24 01:42:47 1.288
+++ gaim.h 2001/10/25 05:05:04 1.289
@@ -401,5 +401,7 @@
extern void system_log(enum log_event, struct gaim_connection *, struct buddy *, int);
extern unsigned char *utf8_to_str(unsigned char *);
extern char *str_to_utf8(unsigned char *);
+extern char *add_cr(char *);
+extern void strip_linefeed(char *);
#endif /* _GAIM_H_ */
Index: util.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/util.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- util.c 2001/10/24 08:48:05 1.108
+++ util.c 2001/10/25 05:05:05 1.109
@@ -1166,10 +1166,12 @@
n += 2;
continue;
}
+ /* why are we removing newlines and carriage returns?
if ((c == 0x0D) || (c == 0x0A)) {
n++;
continue;
}
+ */
if (c < 128)
result[i++] = (char)c;
else {
@@ -1181,6 +1183,51 @@
result[i] = '\0';
return result;
+}
+
+void strip_linefeed(gchar *text)
+{
+ int i, j;
+ gchar *text2 = g_malloc(strlen(text) + 1);
+
+ for (i = 0, j = 0; text[i]; i++)
+ if (text[i] != '\r')
+ text2[j++] = text[i];
+ text2[j] = '\0';
+
+ strcpy(text, text2);
+ g_free(text2);
+}
+
+char *add_cr(char *text)
+{
+ char *ret = NULL;
+ int count = 0, i, j;
+
+ if (text[0] == '\n')
+ count++;
+ for (i = 1; i < strlen(text); i++)
+ if (text[i] == '\n' && text[i - 1] != '\r')
+ count++;
+
+ if (count == 0)
+ return g_strdup(text);
+
+ ret = g_malloc0(strlen(text) + count + 1);
+
+ i = 0; j = 0;
+ if (text[i] == '\n')
+ ret[j++] = '\r';
+ ret[j++] = text[i++];
+ for (; i < strlen(text); i++) {
+ if (text[i] == '\n' && text[i - 1] != '\r')
+ ret[j++] = '\r';
+ ret[j++] = text[i];
+ }
+
+ debug_printf("got: %s, leaving with %s\n", text, ret);
+
+ return ret;
}
time_t get_time(int year, int month, int day, int hour, int min, int sec)
|