Mercurial > hg > nnchat
comparison nnchat.c @ 137:fad8c31e41e6
Move browser code around a bit.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Nov 2010 21:45:28 +0200 |
parents | f367fc14021a |
children | c39399725f7b |
comparison
equal
deleted
inserted
replaced
136:4ec36204d34e | 137:fad8c31e41e6 |
---|---|
54 *statusWin = NULL, | 54 *statusWin = NULL, |
55 *editWin = NULL; | 55 *editWin = NULL; |
56 BOOL setPrvMode = FALSE; | 56 BOOL setPrvMode = FALSE; |
57 BOOL ignoreMode = FALSE; | 57 BOOL ignoreMode = FALSE; |
58 | 58 |
59 char *setConfigFile = "config"; | 59 char *setConfigFile = NULL, |
60 *setBrowser = NULL; | |
60 cfgitem_t *cfg = NULL; | 61 cfgitem_t *cfg = NULL; |
61 | 62 |
62 | 63 |
63 /* Arguments | 64 /* Arguments |
64 */ | 65 */ |
580 | 581 |
581 fclose(f); | 582 fclose(f); |
582 return 0; | 583 return 0; |
583 } else if (!strncasecmp(buf, "/w ", 3)) { | 584 } else if (!strncasecmp(buf, "/w ", 3)) { |
584 /* Open given username's profile via firefox in a new tab */ | 585 /* Open given username's profile via firefox in a new tab */ |
585 char *name = trimLeft(buf + 3), | 586 char *name = trimLeft(buf + 3); |
586 *browser = getenv("BROWSER"); | |
587 | |
588 if (browser == NULL) | |
589 browser = "firefox"; | |
590 | 587 |
591 printMsg("Opening profile for: '%s'\n", name); | 588 printMsg("Opening profile for: '%s'\n", name); |
592 | 589 |
593 tmpStr = nn_encode_str1(name); | 590 tmpStr = nn_encode_str1(name); |
594 snprintf(tmpBuf, sizeof(tmpBuf), "openurl(http://www.newbienudes.com/profile/%s/,new-tab)", tmpStr); | 591 snprintf(tmpBuf, sizeof(tmpBuf), "openurl(http://www.newbienudes.com/profile/%s/,new-tab)", tmpStr); |
601 int status; | 598 int status; |
602 pid_t pid; | 599 pid_t pid; |
603 if ((pid = fork()) < 0) { | 600 if ((pid = fork()) < 0) { |
604 printMsg("Could not create sub-process!\n"); | 601 printMsg("Could not create sub-process!\n"); |
605 } else if (pid == 0) { | 602 } else if (pid == 0) { |
606 execlp(browser, browser, "-remote", tmpBuf, NULL); | 603 execlp(setBrowser, setBrowser, "-remote", tmpBuf, NULL); |
607 _exit(errno); | 604 _exit(errno); |
608 } | 605 } |
609 | 606 |
610 wait(&status); | 607 wait(&status); |
611 } | 608 } |
806 th_cfg_add_string(&cfg, "ignores", ignoreList, NULL); | 803 th_cfg_add_string(&cfg, "ignores", ignoreList, NULL); |
807 | 804 |
808 if ((cfgfile = fopen(setConfigFile, "r")) != NULL) | 805 if ((cfgfile = fopen(setConfigFile, "r")) != NULL) |
809 th_cfg_read(cfgfile, setConfigFile, cfg); | 806 th_cfg_read(cfgfile, setConfigFile, cfg); |
810 } | 807 } |
808 | |
809 setBrowser = getenv("BROWSER"); | |
810 if (setBrowser == NULL) | |
811 setBrowser = "firefox"; | |
811 | 812 |
812 /* Parse arguments */ | 813 /* Parse arguments */ |
813 argsOK = th_args_process(argc, argv, optList, optListN, | 814 argsOK = th_args_process(argc, argv, optList, optListN, |
814 argHandleOpt, argHandleFile, FALSE); | 815 argHandleOpt, argHandleFile, FALSE); |
815 | 816 |