Mercurial > pidgin
comparison src/browser.c @ 5513:d1524728d491
[gaim-migrate @ 5912]
Dario Sarango (darius_wolfson) patched bug 743000 writting:
"Summary: scans the manual browser command for multiple %s. If
multiple %s are found, error message is given and the web_command
is not executed. "
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 25 May 2003 16:52:35 +0000 |
parents | ad445074d239 |
children | 439a05a6b409 |
comparison
equal
deleted
inserted
replaced
5512:e41b04bb4afe | 5513:d1524728d491 |
---|---|
583 command = g_strdup_printf("mozilla \"%s\"", url); | 583 command = g_strdup_printf("mozilla \"%s\"", url); |
584 break; | 584 break; |
585 | 585 |
586 case BROWSER_MANUAL: { | 586 case BROWSER_MANUAL: { |
587 char *space_free_url = NULL; | 587 char *space_free_url = NULL; |
588 char *web_tmp = NULL; | |
588 | 589 |
589 if (!web_command[0]) { | 590 if (!web_command[0]) { |
590 gaim_notify_error(NULL, NULL, | 591 gaim_notify_error(NULL, NULL, |
591 _("Unable to launch your browser because " | 592 _("Unable to launch your browser because " |
592 "the 'Manual' browser command has been " | 593 "the 'Manual' browser command has been " |
595 return; | 596 return; |
596 } | 597 } |
597 | 598 |
598 space_free_url = g_strdup(url); | 599 space_free_url = g_strdup(url); |
599 g_strdelimit(space_free_url, " ", '+'); | 600 g_strdelimit(space_free_url, " ", '+'); |
600 if(strstr(web_command, "%s")) | 601 /* |
602 if (strstr(web_command, "%s")) | |
601 command = g_strdup_printf(web_command, space_free_url); | 603 command = g_strdup_printf(web_command, space_free_url); |
604 | |
605 Replaced the above with the following to avoid users | |
606 from entering more than one %s as part of the browser | |
607 command. | |
608 */ | |
609 web_tmp = strstr(web_command, "%s"); | |
610 if(web_tmp) | |
611 { | |
612 if (strstr((web_tmp + 1), "%s")) | |
613 command = g_strdup_printf(web_command, space_free_url); | |
614 else | |
615 gaim_notify_error(NULL, NULL, _("Unable to launch your browser because the 'Manual' browser command has too many '%s'."), NULL); | |
616 } | |
602 else | 617 else |
603 command = g_strdup_printf("%s %s", web_command, space_free_url); | 618 command = g_strdup_printf("%s %s", web_command, space_free_url); |
604 g_free(space_free_url); | 619 g_free(space_free_url); |
620 g_free(web_tmp); | |
605 } break; | 621 } break; |
606 } | 622 } |
607 | 623 |
608 if (g_spawn_command_line_async(command, &error) == FALSE) { | 624 if (g_spawn_command_line_async(command, &error) == FALSE) { |
609 char *tmp = g_strdup_printf(_("There was an error launching your chosen browser: %s"), error->message); | 625 char *tmp = g_strdup_printf(_("There was an error launching your chosen browser: %s"), error->message); |