Changeset 4197 for trunk/console
- Timestamp:
- 08/27/05 08:17:33 (3 years ago)
- Location:
- trunk/console/src
- Files:
-
- 5 modified
-
console.cpp (modified) (6 diffs)
-
console.h (modified) (1 diff)
-
console_menu.cpp (modified) (15 diffs)
-
console_print.cpp (modified) (2 diffs)
-
window.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/console/src/console.cpp
r4192 r4197 257 257 scrollok(winCon[i]->Win(), true); 258 258 winCon[i]->fProcessInput = &CLicqConsole::InputCommand; 259 winCon[i]->data = NULL;259 winCon[i]->data = NULL; 260 260 } 261 261 winCon[0]->fProcessInput = &CLicqConsole::InputLogWindow; … … 1452 1452 } 1453 1453 1454 1455 1454 /*--------------------------------------------------------------------------- 1455 * CLicqConsole::SaveLastUser 1456 *-------------------------------------------------------------------------*/ 1457 void CLicqConsole::SaveLastUser(const char *szId, unsigned long nPPID) 1458 { 1459 // Save this as the last user 1460 if (winMain->sLastContact.szId == 0 || 1461 !(strcmp(szId, winMain->sLastContact.szId) == 0 && 1462 nPPID == winMain->sLastContact.nPPID)) 1463 { 1464 if (winMain->sLastContact.szId) 1465 free(winMain->sLastContact.szId); 1466 winMain->sLastContact.nPPID = nPPID; 1467 winMain->sLastContact.szId = strdup(szId); 1468 PrintStatus(); 1469 } 1470 } 1456 1471 1457 1472 /*--------------------------------------------------------------------------- … … 2072 2087 2073 2088 winMain->event = licqDaemon->icqFileTransfer(strtoul(data->szId, (char **)NULL, 10), 2074 data->szFileName, data->szDescription, lFileList, ICQ_TCPxMSG_NORMAL,2089 data->szFileName, data->szDescription, lFileList, ICQ_TCPxMSG_NORMAL, 2075 2090 !bDirect); 2076 2091 break; … … 2960 2975 } 2961 2976 2962 winMain->state = STATE_QUERY;2963 winMain->wprintf("\nSave password? (y/N) ");2977 winMain->state = STATE_QUERY; 2978 winMain->wprintf("\nSave password? (y/N) "); 2964 2979 } 2965 2980 break; … … 3008 3023 3009 3024 // Passwords match if we are this far, now set up the new user 3010 winMain->wprintf("Registration complete for user %s\n",data->szUin);3025 winMain->wprintf("Registration complete for user %s\n",data->szUin); 3011 3026 gUserManager.SetOwnerUin(atol(data->szUin)); 3012 3027 ICQOwner *owner = gUserManager.FetchOwner(LOCK_W); … … 3014 3029 gUserManager.DropOwner(); 3015 3030 3016 winMain->wprintf("Save password? (y/N) ");3017 winMain->state = STATE_QUERY;3031 winMain->wprintf("Save password? (y/N) "); 3032 winMain->state = STATE_QUERY; 3018 3033 } 3019 3034 break; -
trunk/console/src/console.h
r4175 r4197 209 209 bool ParseMacro(char *); 210 210 unsigned long GetUinFromArg(char **); 211 void SaveLastUser(const char *, unsigned long); 211 212 struct SContact GetContactFromArg(char **); 212 213 }; -
trunk/console/src/console_menu.cpp
r4143 r4197 11 11 "Force a refresh of the contact list." }, 12 12 { "console", &CLicqConsole::MenuSwitchConsole, NULL, 13 " %B%ccons%bole <num>",14 "Switch to a console." },13 " %B%ccons%bole <num>", 14 "Switch to a console." }, 15 15 { "group", &CLicqConsole::MenuGroup, NULL, 16 16 " %B%cg%broup [ %B#%b ]", … … 26 26 "Authorize grant or refuse the given user." }, 27 27 { "history", &CLicqConsole::MenuHistory, &CLicqConsole::TabUser, 28 " %B%chi%bstory %B<user> %b [ %B#%b,%B#%b ]",28 " %B%chi%bstory %B<user>[.protocol]%b [ %B#%b,%B#%b ]", 29 29 "Print the given range of events from the history.\n" 30 30 "'$' represents the last message, and +/- can be used to specify " … … 42 42 "...\n" }, 43 43 { "message", &CLicqConsole::MenuMessage, &CLicqConsole::TabUser, 44 " %B%cm%bessage %B<user> %b",44 " %B%cm%bessage %B<user>[.protocol]%b", 45 45 "Send a message to a user." }, 46 46 { "url", &CLicqConsole::MenuUrl, &CLicqConsole::TabUser, … … 57 57 "Display user information." }, 58 58 { "view", &CLicqConsole::MenuView, &CLicqConsole::TabUser, 59 " %B%cv%biew [ %B<user> %b ]",59 " %B%cv%biew [ %B<user>[.protocol]%b ]", 60 60 "View an incoming event." }, 61 61 { "secure", &CLicqConsole::MenuSecure, &CLicqConsole::TabUser, … … 66 66 "View a user's auto-reponse or set your own (use #)." }, 67 67 { "remove", &CLicqConsole::MenuRemove, &CLicqConsole::TabUser, 68 " %B%cr%bemove %B<user> %b",68 " %B%cr%bemove %B<user>[.protocol]%b", 69 69 "Remove a user from your contact list." }, 70 70 { "status", &CLicqConsole::MenuStatus, &CLicqConsole::TabStatus, … … 150 150 break; 151 151 } 152 } 153 break; 152 } 153 SaveLastUser((*it)->szId, (*it)->nPPID); 154 break; 154 155 } 155 156 } … … 189 190 { 190 191 list <SScrollUser *>::iterator it; 191 for (it = m_lScrollUsers.begin(); it != m_lScrollUsers.end(); it++)192 for (it = m_lScrollUsers.begin(); it != m_lScrollUsers.end(); it++) 192 193 { 193 194 if ((*it)->pos == userSelected) … … 205 206 UserCommand_Msg((*it)->szId, (*it)->nPPID, NULL); 206 207 } 208 SaveLastUser((*it)->szId, (*it)->nPPID); 207 209 break; 208 210 } … … 274 276 PrintBoxLeft(); 275 277 winMain->wprintf("[%3d] %s v%s", (*pit)->Id(), (*pit)->Name(), 276 (*pit)->Version());278 (*pit)->Version()); 277 279 PrintBoxRight(70); 278 280 } … … 692 694 char *szAlias, *szCmd; 693 695 char *szArg = *p_szArg; 696 unsigned long nPPID = 0; 694 697 struct SContact scon; 695 698 scon.szId = NULL; … … 698 701 return scon; 699 702 } 703 704 string strArg(szArg); 705 string::size_type nPos = strArg.find_last_of("."); 706 if (nPos != string::npos) 707 { 708 string strProtocol(strArg, nPos + 1, strArg.size()); 709 ProtoPluginsList pl; 710 ProtoPluginsListIter it; 711 licqDaemon->ProtoPluginList(pl); 712 for (it = pl.begin(); it != pl.end(); it++) 713 { 714 if (strcasecmp((*it)->Name(), strProtocol.c_str()) == 0) 715 { 716 nPPID = (*it)->PPID(); 717 szArg[strArg.find_last_of(".")] = '\0'; 718 break; 719 } 720 } 721 } 722 700 723 701 724 // Check if the alias is quoted … … 741 764 FOR_EACH_USER_START(LOCK_R) 742 765 { 743 if (strcasecmp(szAlias, pUser->GetAlias()) == 0) 766 if ((nPPID && pUser->PPID() == nPPID && strcasecmp(szAlias, pUser->GetAlias()) == 0) || 767 (!nPPID && strcasecmp(szAlias, pUser->GetAlias()) == 0)) 744 768 { 745 769 scon.szId = pUser->IdString(); … … 747 771 FOR_EACH_PROTO_USER_BREAK; 748 772 } 749 else if (strcasecmp(szAlias, pUser->IdString()) == 0) 773 else if ((nPPID && pUser->PPID() == nPPID && strcasecmp(szAlias, pUser->IdString()) == 0) || 774 (!nPPID && strcasecmp(szAlias, pUser->IdString()) == 0)) 750 775 { 751 776 scon.szId = pUser->IdString(); … … 762 787 return scon; 763 788 } 764 765 // Save this as the last user 766 if (winMain->sLastContact.szId == 0 || 767 !(strcmp(scon.szId, winMain->sLastContact.szId) == 0 && 768 scon.nPPID == winMain->sLastContact.nPPID)) 769 { 770 if (winMain->sLastContact.szId) 771 free(winMain->sLastContact.szId); 772 winMain->sLastContact.nPPID = scon.nPPID; 773 winMain->sLastContact.szId = strdup(scon.szId); 774 PrintStatus(); 775 } 776 789 SaveLastUser(scon.szId, scon.nPPID); 777 790 return scon; 778 791 } … … 890 903 { 891 904 szId = pUser->IdString(); 892 nPPID = pUser->PPID();905 nPPID = pUser->PPID(); 893 906 t = pUser->Touched(); 894 907 } -
trunk/console/src/console_print.cpp
r4185 r4197 336 336 337 337 // Create the line to printout now 338 if (pUser->NewMessages() > 0)338 if (pUser->NewMessages() > 0) 339 339 { 340 340 s->szLine = new char[strlen(szTmp) + 19]; 341 341 snprintf(s->szLine, strlen(szTmp) + 19, "</%d></K>%s<!K><!%d>", s->color->nColor - 6, szTmp ? szTmp : "", s->color->nColor - 6); 342 342 s->szLine[strlen(szTmp) + 18] = '\0'; 343 } else {343 } else { 344 344 s->szLine = new char[strlen(szTmp) + 11]; 345 snprintf(s->szLine, strlen(szTmp) + 11, "</%d>%s<!%d>", s->color->nColor, szTmp ? szTmp : "", s->color->nColor);345 snprintf(s->szLine, strlen(szTmp) + 11, "</%d>%s<!%d>", s->color->nColor, szTmp ? szTmp : "", s->color->nColor); 346 346 s->szLine[strlen(szTmp) + 10] = '\0'; 347 }347 } 348 348 free(szTmp); 349 349 … … 385 385 { 386 386 s = new SScrollUser; 387 s->pos = i;388 s->nPPID = (*it)->nPPID;387 s->pos = i; 388 s->nPPID = (*it)->nPPID; 389 389 s->color = (*it)->color; 390 sprintf(s->szId, "%s", (*it)->szId);391 390 sprintf(s->szId, "%s", (*it)->szId); 391 392 392 m_lScrollUsers.push_back(s); 393 393 ulist[i++] = copyChar((*it)->szLine); -
trunk/console/src/window.cpp
r3922 r4197 63 63 else 64 64 { 65 win = newwin(rows, cols, y, x);65 win = newwin(rows, cols, y, x); 66 66 wmove(win, 0, 0); 67 67 } … … 73 73 if (_useCDK) 74 74 { 75 initCDKColor();75 initCDKColor(); 76 76 cdkscreen = initCDKScreen(win); 77 77 if (cdkscreen == NULL) … … 81 81 } 82 82 } 83 83 84 84 nLastUin = 0; 85 85 sLastContact.szId = 0;
