| 94 dir = g_dir_open(path, 0, NULL); |
94 dir = g_dir_open(path, 0, NULL); |
| 95 if (dir) { |
95 if (dir) { |
| 96 const gchar *file; |
96 const gchar *file; |
| 97 |
97 |
| 98 while ((file = g_dir_read_name(dir))) { |
98 while ((file = g_dir_read_name(dir))) { |
| 99 if (!g_str_has_prefix(file, sn)) |
99 if (!gaim_str_has_prefix(file, sn)) |
| 100 continue; |
100 continue; |
| 101 if (g_str_has_suffix(file, ".html") || g_str_has_suffix(file, ".AdiumHTMLLog")) { |
101 if (gaim_str_has_suffix(file, ".html") || gaim_str_has_suffix(file, ".AdiumHTMLLog")) { |
| 102 struct tm tm; |
102 struct tm tm; |
| 103 const char *date = file; |
103 const char *date = file; |
| 104 |
104 |
| 105 date += strlen(sn) + 2; |
105 date += strlen(sn) + 2; |
| 106 if (sscanf(date, "%u|%u|%u", |
106 if (sscanf(date, "%u|%u|%u", |
| 161 log->logger = adium_logger; |
161 log->logger = adium_logger; |
| 162 log->logger_data = data; |
162 log->logger_data = data; |
| 163 |
163 |
| 164 list = g_list_append(list, log); |
164 list = g_list_append(list, log); |
| 165 } |
165 } |
| 166 } else if (g_str_has_suffix(file, ".adiumLog")) { |
166 } else if (gaim_str_has_suffix(file, ".adiumLog")) { |
| 167 struct tm tm; |
167 struct tm tm; |
| 168 const char *date = file; |
168 const char *date = file; |
| 169 |
169 |
| 170 date += strlen(sn) + 2; |
170 date += strlen(sn) + 2; |
| 171 if (sscanf(date, "%u|%u|%u", |
171 if (sscanf(date, "%u|%u|%u", |
| 855 * The first step is to determine if either of the names matches either my |
855 * The first step is to determine if either of the names matches either my |
| 856 * friendly name or alias. For this test, "match" is defined as: |
856 * friendly name or alias. For this test, "match" is defined as: |
| 857 * ^(friendly_name|alias)([^a-zA-Z0-9].*)?$ |
857 * ^(friendly_name|alias)([^a-zA-Z0-9].*)?$ |
| 858 */ |
858 */ |
| 859 from_name_matches = from_name != NULL && ( |
859 from_name_matches = from_name != NULL && ( |
| 860 (g_str_has_prefix(from_name, friendly_name) && |
860 (gaim_str_has_prefix(from_name, friendly_name) && |
| 861 !isalnum(*(from_name + friendly_name_length))) || |
861 !isalnum(*(from_name + friendly_name_length))) || |
| 862 (g_str_has_prefix(from_name, log->account->alias) && |
862 (gaim_str_has_prefix(from_name, log->account->alias) && |
| 863 !isalnum(*(from_name + alias_length)))); |
863 !isalnum(*(from_name + alias_length)))); |
| 864 |
864 |
| 865 to_name_matches = to_name != NULL && ( |
865 to_name_matches = to_name != NULL && ( |
| 866 (gaim_str_has_prefix(to_name, friendly_name) && |
866 (gaim_str_has_prefix(to_name, friendly_name) && |
| 867 !isalnum(*(to_name + friendly_name_length))) || |
867 !isalnum(*(to_name + friendly_name_length))) || |
| 921 * The first step is to determine if either of |
921 * The first step is to determine if either of |
| 922 * the names matches their friendly name. For |
922 * the names matches their friendly name. For |
| 923 * this test, "match" is defined as: |
923 * this test, "match" is defined as: |
| 924 * ^friendly_name([^a-zA-Z0-9].*)?$ |
924 * ^friendly_name([^a-zA-Z0-9].*)?$ |
| 925 */ |
925 */ |
| 926 from_name_matches = (g_str_has_prefix( |
926 from_name_matches = (gaim_str_has_prefix( |
| 927 from_name, |
927 from_name, |
| 928 buddy->server_alias) && |
928 buddy->server_alias) && |
| 929 !isalnum(*(from_name + |
929 !isalnum(*(from_name + |
| 930 friendly_name_length))); |
930 friendly_name_length))); |
| 931 |
931 |
| 932 to_name_matches = (g_str_has_prefix( |
932 to_name_matches = (gaim_str_has_prefix( |
| 933 to_name, buddy->server_alias) && |
933 to_name, buddy->server_alias) && |
| 934 !isalnum(*(to_name + |
934 !isalnum(*(to_name + |
| 935 friendly_name_length))); |
935 friendly_name_length))); |
| 936 |
936 |
| 937 if (from_name_matches) { |
937 if (from_name_matches) { |
| 1395 line = timestamp; |
1395 line = timestamp; |
| 1396 if (line[1] && line[2]) |
1396 if (line[1] && line[2]) |
| 1397 line += 2; |
1397 line += 2; |
| 1398 } |
1398 } |
| 1399 |
1399 |
| 1400 if (g_str_has_prefix(line, "*** ")) { |
1400 if (gaim_str_has_prefix(line, "*** ")) { |
| 1401 line += (sizeof("*** ") - 1); |
1401 line += (sizeof("*** ") - 1); |
| 1402 g_string_append(formatted, "<b>"); |
1402 g_string_append(formatted, "<b>"); |
| 1403 footer = "</b>"; |
1403 footer = "</b>"; |
| 1404 if (g_str_has_prefix(line, "NOTE: This user is offline.")) { |
1404 if (gaim_str_has_prefix(line, "NOTE: This user is offline.")) { |
| 1405 line = _("User is offline."); |
1405 line = _("User is offline."); |
| 1406 } else if (g_str_has_prefix(line, |
1406 } else if (gaim_str_has_prefix(line, |
| 1407 "NOTE: Your status is currently set to ")) { |
1407 "NOTE: Your status is currently set to ")) { |
| 1408 |
1408 |
| 1409 line += (sizeof("NOTE: ") - 1); |
1409 line += (sizeof("NOTE: ") - 1); |
| 1410 } else if (g_str_has_prefix(line, "Auto-response sent to ")) { |
1410 } else if (gaim_str_has_prefix(line, "Auto-response sent to ")) { |
| 1411 g_string_append(formatted, _("Auto-response sent:")); |
1411 g_string_append(formatted, _("Auto-response sent:")); |
| 1412 while (*line && *line != ':') |
1412 while (*line && *line != ':') |
| 1413 line++; |
1413 line++; |
| 1414 if (*line) |
1414 if (*line) |
| 1415 line++; |
1415 line++; |
| 1427 if (buddy != NULL && buddy->alias) |
1427 if (buddy != NULL && buddy->alias) |
| 1428 g_string_append(formatted, buddy->alias); |
1428 g_string_append(formatted, buddy->alias); |
| 1429 else |
1429 else |
| 1430 g_string_append(formatted, log->name); |
1430 g_string_append(formatted, log->name); |
| 1431 line = " logged in."; |
1431 line = " logged in."; |
| 1432 } else if (g_str_has_prefix(line, |
1432 } else if (gaim_str_has_prefix(line, |
| 1433 "One or more messages may have been undeliverable.")) { |
1433 "One or more messages may have been undeliverable.")) { |
| 1434 |
1434 |
| 1435 g_string_append(formatted, |
1435 g_string_append(formatted, |
| 1436 "<span style=\"color: #ff0000;\">"); |
1436 "<span style=\"color: #ff0000;\">"); |
| 1437 g_string_append(formatted, |
1437 g_string_append(formatted, |
| 1438 _("One or more messages may have been " |
1438 _("One or more messages may have been " |
| 1439 "undeliverable.")); |
1439 "undeliverable.")); |
| 1440 line = ""; |
1440 line = ""; |
| 1441 footer = "</span></b>"; |
1441 footer = "</span></b>"; |
| 1442 } else if (g_str_has_prefix(line, |
1442 } else if (gaim_str_has_prefix(line, |
| 1443 "You have been disconnected.")) { |
1443 "You have been disconnected.")) { |
| 1444 |
1444 |
| 1445 g_string_append(formatted, |
1445 g_string_append(formatted, |
| 1446 "<span style=\"color: #ff0000;\">"); |
1446 "<span style=\"color: #ff0000;\">"); |
| 1447 g_string_append(formatted, |
1447 g_string_append(formatted, |
| 1448 _("You were disconnected from the server.")); |
1448 _("You were disconnected from the server.")); |
| 1449 line = ""; |
1449 line = ""; |
| 1450 footer = "</span></b>"; |
1450 footer = "</span></b>"; |
| 1451 } else if (g_str_has_prefix(line, |
1451 } else if (gaim_str_has_prefix(line, |
| 1452 "You are currently disconnected.")) { |
1452 "You are currently disconnected.")) { |
| 1453 |
1453 |
| 1454 g_string_append(formatted, |
1454 g_string_append(formatted, |
| 1455 "<span style=\"color: #ff0000;\">"); |
1455 "<span style=\"color: #ff0000;\">"); |
| 1456 line = _("You are currently disconnected. Messages " |
1456 line = _("You are currently disconnected. Messages " |
| 1457 "will not be received unless you are " |
1457 "will not be received unless you are " |
| 1458 "logged in."); |
1458 "logged in."); |
| 1459 footer = "</span></b>"; |
1459 footer = "</span></b>"; |
| 1460 } else if (g_str_has_prefix(line, |
1460 } else if (gaim_str_has_prefix(line, |
| 1461 "Your previous message has not been sent.")) { |
1461 "Your previous message has not been sent.")) { |
| 1462 |
1462 |
| 1463 g_string_append(formatted, |
1463 g_string_append(formatted, |
| 1464 "<span style=\"color: #ff0000;\">"); |
1464 "<span style=\"color: #ff0000;\">"); |
| 1465 |
1465 |
| 1466 if (g_str_has_prefix(line, |
1466 if (gaim_str_has_prefix(line, |
| 1467 "Your previous message has not been sent. " |
1467 "Your previous message has not been sent. " |
| 1468 "Reason: Maximum length exceeded.")) { |
1468 "Reason: Maximum length exceeded.")) { |
| 1469 |
1469 |
| 1470 g_string_append(formatted, |
1470 g_string_append(formatted, |
| 1471 _("Message could not be sent because " |
1471 _("Message could not be sent because " |
| 1479 "has not been sent. ") - 1); |
1479 "has not been sent. ") - 1); |
| 1480 } |
1480 } |
| 1481 |
1481 |
| 1482 footer = "</span></b>"; |
1482 footer = "</span></b>"; |
| 1483 } |
1483 } |
| 1484 } else if (g_str_has_prefix(line, data->their_nickname)) { |
1484 } else if (gaim_str_has_prefix(line, data->their_nickname)) { |
| 1485 if (buddy != NULL && buddy->alias) { |
1485 if (buddy != NULL && buddy->alias) { |
| 1486 line += strlen(data->their_nickname) + 2; |
1486 line += strlen(data->their_nickname) + 2; |
| 1487 g_string_append_printf(formatted, |
1487 g_string_append_printf(formatted, |
| 1488 "<span style=\"color: #A82F2F;\">" |
1488 "<span style=\"color: #A82F2F;\">" |
| 1489 "<b>%s</b></span>: ", buddy->alias); |
1489 "<b>%s</b></span>: ", buddy->alias); |