| 1835 logfound = 1; |
1835 logfound = 1; |
| 1836 lastoff = offset; |
1836 lastoff = offset; |
| 1837 |
1837 |
| 1838 g_snprintf(convostart, length, "%s", temp); |
1838 g_snprintf(convostart, length, "%s", temp); |
| 1839 memset(&tm, 0, sizeof(tm)); |
1839 memset(&tm, 0, sizeof(tm)); |
| 1840 sscanf(convostart, "%*s %3s %d %d:%d:%d %d", |
1840 if (sscanf(convostart, "%*s %3s %d %d:%d:%d %d", month, |
| 1841 month, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &tm.tm_year); |
1841 &tm.tm_mday, &tm.tm_hour, &tm.tm_min, |
| |
1842 &tm.tm_sec, &tm.tm_year) != 6) |
| |
1843 { |
| |
1844 purple_debug_warning("log", "invalid date format\n"); |
| |
1845 } |
| 1842 /* Ugly hack, in case current locale is not English */ |
1846 /* Ugly hack, in case current locale is not English */ |
| 1843 if (purple_strequal(month, "Jan")) { |
1847 if (purple_strequal(month, "Jan")) { |
| 1844 tm.tm_mon= 0; |
1848 tm.tm_mon= 0; |
| 1845 } else if (purple_strequal(month, "Feb")) { |
1849 } else if (purple_strequal(month, "Feb")) { |
| 1846 tm.tm_mon = 1; |
1850 tm.tm_mon = 1; |
| 1941 size_t result; |
1945 size_t result; |
| 1942 struct old_logger_data *data = log->logger_data; |
1946 struct old_logger_data *data = log->logger_data; |
| 1943 const char *path = purple_stringref_value(data->pathref); |
1947 const char *path = purple_stringref_value(data->pathref); |
| 1944 FILE *file = g_fopen(path, "rb"); |
1948 FILE *file = g_fopen(path, "rb"); |
| 1945 char *read = g_malloc(data->length + 1); |
1949 char *read = g_malloc(data->length + 1); |
| 1946 fseek(file, data->offset, SEEK_SET); |
1950 if (fseek(file, data->offset, SEEK_SET) != 0) |
| 1947 result = fread(read, data->length, 1, file); |
1951 result = 0; |
| |
1952 else |
| |
1953 result = fread(read, data->length, 1, file); |
| 1948 if (result != 1) |
1954 if (result != 1) |
| 1949 purple_debug_error("log", "Unable to read from log file: %s\n", path); |
1955 purple_debug_error("log", "Unable to read from log file: %s\n", path); |
| 1950 fclose(file); |
1956 fclose(file); |
| 1951 read[data->length] = '\0'; |
1957 read[data->length] = '\0'; |
| 1952 *flags = 0; |
1958 *flags = 0; |