changeset 18108:c0cd4d84ba52

Fix a mistake noticed by Michael Shkutkov and add a comment explaining the code.
author Richard Laager <rlaager@wiktel.com>
date Sat, 16 Jun 2007 02:21:13 +0000
parents d865909b6646
children 3d7129ac1de9 59aec2d6ec43
files libpurple/plugins/log_reader.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/log_reader.c	Fri Jun 15 20:52:29 2007 +0000
+++ b/libpurple/plugins/log_reader.c	Sat Jun 16 02:21:13 2007 +0000
@@ -1290,9 +1290,16 @@
 						list = g_list_delete_link(list, last);
 					}
 				}
-			} else if (line[0] && line[1] && line [3] &&
+			} else if (line[0] && line[1] && line[2] &&
 					   purple_str_has_prefix(&line[3], "sion Start ")) {
-
+				/* The conditional is to make sure we're not reading off
+				 * the end of the string.  We don't want strlen(), as that'd
+				 * have to count the whole string needlessly.
+				 * 
+				 * The odd check here is because a Session Start at the
+				 * beginning of the file can be overwritten with a UTF-8
+				 * byte order mark.  Yes, it's weird.
+				 */
 				char *their_nickname = line;
 				char *timestamp;