Changeset 6461 for trunk/console
- Timestamp:
- 07/24/08 03:58:36 (4 months ago)
- Location:
- trunk/console/src
- Files:
-
- 6 modified
-
console.cpp (modified) (1 diff)
-
console.h (modified) (2 diffs)
-
console_menu.cpp (modified) (7 diffs)
-
console_print.cpp (modified) (2 diffs)
-
window.cpp (modified) (2 diffs)
-
window.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/console/src/console.cpp
r6406 r6461 1467 1467 * CLicqConsole::SaveLastUser 1468 1468 *-------------------------------------------------------------------------*/ 1469 void CLicqConsole::SaveLastUser(const char *szId, unsigned long nPPID)1469 void CLicqConsole::SaveLastUser(const string& id, unsigned long nPPID) 1470 1470 { 1471 1471 // Save this as the last user 1472 if (winMain->sLastContact.szId == 0||1473 !( strcmp(szId, winMain->sLastContact.szId) == 0&&1472 if (winMain->sLastContact.szId.empty() || 1473 !(id == winMain->sLastContact.szId && 1474 1474 nPPID == winMain->sLastContact.nPPID)) 1475 1475 { 1476 if (winMain->sLastContact.szId)1477 free(winMain->sLastContact.szId);1478 1476 winMain->sLastContact.nPPID = nPPID; 1479 winMain->sLastContact.szId = strdup(szId);1477 winMain->sLastContact.szId = id; 1480 1478 PrintStatus(); 1481 1479 } -
trunk/console/src/console.h
r6439 r6461 154 154 void PrintFileStat(CFileTransferManager *); 155 155 void PrintMacros(); 156 void PrintContactPopup(c har *);156 void PrintContactPopup(const char* alias); 157 157 158 158 static int UserListCallback(EObjectType, void *, void *, chtype); … … 215 215 bool ParseMacro(char *); 216 216 std::string GetUserFromArg(char** p_szArg); 217 void SaveLastUser(const char *, unsigned long);217 void SaveLastUser(const std::string& id, unsigned long ppid); 218 218 struct SContact GetContactFromArg(char **); 219 219 }; -
trunk/console/src/console_menu.cpp
r6439 r6461 679 679 unsigned long nPPID = 0; 680 680 struct SContact scon; 681 scon.szId = NULL;682 681 scon.nPPID = 0; 683 682 … … 766 765 } 767 766 FOR_EACH_USER_END 768 if (scon.szId == NULL)767 if (scon.szId.empty()) 769 768 { 770 769 winMain->wprintf("%CInvalid user: %A%s\n", COLOR_RED, A_BOLD, szAlias); 771 scon.szId = NULL;770 scon.szId.clear(); 772 771 scon.nPPID = (unsigned long)-1; 773 772 return scon; … … 787 786 struct SContact scon = GetContactFromArg(&sz); 788 787 789 if ( !scon.szId&& scon.nPPID != (unsigned long)-1)788 if (scon.szId.empty() && scon.nPPID != (unsigned long)-1) 790 789 winMain->wprintf("%CYou must specify a user to send a message to.\n", COLOR_RED); 791 790 else if (scon.nPPID != (unsigned long)-1) 792 UserCommand_Msg(scon.szId , scon.nPPID, sz);791 UserCommand_Msg(scon.szId.c_str(), scon.nPPID, sz); 793 792 } 794 793 … … 853 852 854 853 char *sz = szArg; 855 char *szId = NULL;854 string szId; 856 855 unsigned long nPPID = (unsigned long)-1; 857 856 struct SContact scon = GetContactFromArg(&sz); 858 859 if (scon.szId == 0)857 858 if (scon.szId.empty()) 860 859 { 861 860 // Do nothing if there are no events pending … … 884 883 } 885 884 FOR_EACH_USER_END 886 if ( szId != NULL)887 { 888 UserCommand_View(szId , nPPID, NULL);889 } 890 } 891 else if ( scon.szId != NULL)892 { 893 UserCommand_View(scon.szId , scon.nPPID, sz);885 if (!szId.empty()) 886 { 887 UserCommand_View(szId.c_str(), nPPID, NULL); 888 } 889 } 890 else if (!scon.szId.empty()) 891 { 892 UserCommand_View(scon.szId.c_str(), scon.nPPID, sz); 894 893 } 895 894 … … 988 987 struct SContact scon = GetContactFromArg(&sz); 989 988 990 if (gUserManager.FindOwner(scon.szId , scon.nPPID))989 if (gUserManager.FindOwner(scon.szId.c_str(), scon.nPPID)) 991 990 winMain->wprintf("%CYou can't remove yourself!\n", COLOR_RED); 992 else if ( !scon.szId&& scon.nPPID != (unsigned long)-1)991 else if (scon.szId.empty() && scon.nPPID != (unsigned long)-1) 993 992 winMain->wprintf("%CYou must specify a user to remove.\n", COLOR_RED); 994 993 else 995 UserCommand_Remove(scon.szId , scon.nPPID, sz);994 UserCommand_Remove(scon.szId.c_str(), scon.nPPID, sz); 996 995 } 997 996 … … 1005 1004 struct SContact scon = GetContactFromArg(&sz); 1006 1005 1007 if ( !scon.szId&& scon.nPPID != (unsigned long)-1)1006 if (scon.szId.empty() && scon.nPPID != (unsigned long)-1) 1008 1007 winMain->wprintf("%CYou must specify a user to view history.\n", COLOR_RED); 1009 1008 else if (scon.nPPID != (unsigned long)-1) 1010 UserCommand_History(scon.szId , scon.nPPID, sz);1009 UserCommand_History(scon.szId.c_str(), scon.nPPID, sz); 1011 1010 } 1012 1011 -
trunk/console/src/console_print.cpp
r6439 r6461 149 149 strcpy(szMsgStr, "No Messages"); 150 150 151 if ( winMain->sLastContact.szId != 0)152 { 153 ICQUser *u = gUserManager.FetchUser(winMain->sLastContact.szId,151 if (!winMain->sLastContact.szId.empty()) 152 { 153 ICQUser* u = gUserManager.FetchUser(winMain->sLastContact.szId.c_str(), 154 154 winMain->sLastContact.nPPID, LOCK_R); 155 155 if (u == NULL) … … 466 466 * CLicqConsole::PrintContactPopup 467 467 *-------------------------------------------------------------------------*/ 468 void CLicqConsole::PrintContactPopup(c har *_szAlias)468 void CLicqConsole::PrintContactPopup(const char* _szAlias) 469 469 { 470 470 char title[256]; -
trunk/console/src/window.cpp
r6372 r6461 83 83 84 84 myLastId.clear(); 85 sLastContact.szId = 0;86 85 sLastContact.nPPID = 0; 87 86 nLastHistory = 1; … … 90 89 CWindow::~CWindow() 91 90 { 92 if (sLastContact.szId)93 free(sLastContact.szId);94 91 delwin(win); 95 92 } -
trunk/console/src/window.h
r6372 r6461 38 38 struct SContact 39 39 { 40 char *szId;40 std::string szId; 41 41 unsigned long nPPID; 42 42 };
