Mercurial > hg > nnchat
comparison main.c @ 535:379e361f1144
Fix various segfault issues.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 14 Aug 2012 02:17:03 +0300 |
parents | 52c56ada3816 |
children | 15e447d6a2a6 |
comparison
equal
deleted
inserted
replaced
534:b1bb64e2e776 | 535:379e361f1144 |
---|---|
480 } | 480 } |
481 else | 481 else |
482 { | 482 { |
483 if (checkNameList(setFriendList, name)) | 483 if (checkNameList(setFriendList, name)) |
484 { | 484 { |
485 colorNick = 5; | 485 colorNick = 11; |
486 colorText = 1; | 486 colorText = 0; |
487 } | 487 } |
488 else | 488 else |
489 { | 489 { |
490 colorNick = 15; | 490 colorNick = 15; |
491 colorText = 0; | 491 colorText = 0; |
1504 { | 1504 { |
1505 nnwin_update(editState->update, editState->mask, editBuf, optUserName, optUserColor); | 1505 nnwin_update(editState->update, editState->mask, editBuf, optUserName, optUserColor); |
1506 } | 1506 } |
1507 | 1507 |
1508 | 1508 |
1509 void clearEditState(nn_editstate_t *st) | |
1510 { | |
1511 memset(st, 0, sizeof(nn_editstate_t)); | |
1512 st->insertMode = TRUE; | |
1513 st->debugMsg = debugMsg; | |
1514 } | |
1515 | |
1509 int main(int argc, char *argv[]) | 1516 int main(int argc, char *argv[]) |
1510 { | 1517 { |
1511 char *tmpStr; | 1518 char *tmpStr; |
1512 int index, updateCount = 0; | 1519 int index, updateCount = 0; |
1513 BOOL argsOK, colorSet = FALSE; | 1520 BOOL argsOK, colorSet = FALSE; |
1516 nn_editstate_t editState; | 1523 nn_editstate_t editState; |
1517 cfgitem_t *tmpcfg; | 1524 cfgitem_t *tmpcfg; |
1518 char *setHomeDir = NULL; | 1525 char *setHomeDir = NULL; |
1519 | 1526 |
1520 memset(editHistBuf, 0, sizeof(editHistBuf)); | 1527 memset(editHistBuf, 0, sizeof(editHistBuf)); |
1521 memset(&editState, 0, sizeof(editState)); | 1528 clearEditState(&editState); |
1522 editState.insertMode = TRUE; | |
1523 editState.debugMsg = debugMsg; | |
1524 | 1529 |
1525 // Initialize | 1530 // Initialize |
1526 th_init("NNChat", "Newbie Nudes chat client", NN_VERSION, | 1531 th_init("NNChat", "Newbie Nudes chat client", NN_VERSION, |
1527 "Written and designed by Anonymous Finnish Guy (C) 2008-2012", | 1532 "Written and designed by Anonymous Finnish Guy (C) 2008-2012", |
1528 "This software is freeware, use and distribute as you wish."); | 1533 "This software is freeware, use and distribute as you wish."); |
1855 err_exit: | 1860 err_exit: |
1856 if (errorMessages || editState.isError) | 1861 if (errorMessages || editState.isError) |
1857 { | 1862 { |
1858 char *tmp; | 1863 char *tmp; |
1859 printMsg(NULL, "Press enter to exit.\n"); | 1864 printMsg(NULL, "Press enter to exit.\n"); |
1860 memset(&editState, 0, sizeof(editState)); | 1865 clearEditState(&editState); |
1861 tmp = nnwin_prompt_requester(FALSE, &editState, processUserPrompt, updateUserPrompt); | 1866 tmp = nnwin_prompt_requester(FALSE, &editState, processUserPrompt, updateUserPrompt); |
1862 th_free(tmp); | 1867 th_free(tmp); |
1863 } | 1868 } |
1864 | 1869 |
1865 th_cfg_free(cfg); | 1870 th_cfg_free(cfg); |