diff -ru --exclude-from=exclude centericq-4.20.0/src/icqconf.cc centericq-4.20.0-patched/src/icqconf.cc --- centericq-4.20.0/src/icqconf.cc 2005-01-27 00:52:47.000000000 +0100 +++ centericq-4.20.0-patched/src/icqconf.cc 2005-02-09 10:13:21.000000000 +0100 @@ -242,6 +242,7 @@ of << "bind history\tn\tsearch_again" << endl; of << "bind history\t\tshow_urls" << endl; of << "bind history\t\tfullscreen" << endl << endl; + of << "bind history\t\tshow_contacts" << endl << endl; of << "bind editor\t\\cx\tsend_message" << endl; of << "bind editor\t\tquit" << endl; of << "bind editor\t\\cp\tmultiple_recipients" << endl; @@ -354,6 +355,7 @@ if(param == "rename") k.action = key_rename; else if(param == "version") k.action = key_version; else if(param == "fullscreen") k.action = key_fullscreen; else + if(param == "show_contacts") k.action = key_show_contacts; else if(param == "edit") k.action = key_edit; else if(param == "ignore") k.action = key_ignore; else if(param == "quickfind") k.action = key_quickfind; else diff -ru --exclude-from=exclude centericq-4.20.0/src/icqconf.h centericq-4.20.0-patched/src/icqconf.h --- centericq-4.20.0/src/icqconf.h 2005-01-16 13:59:57.000000000 +0100 +++ centericq-4.20.0-patched/src/icqconf.h 2005-02-09 10:13:21.000000000 +0100 @@ -52,6 +52,7 @@ key_quit, key_change_status, key_history, + key_show_contacts, key_fetch_away_message, key_user_menu, key_general_menu, diff -ru --exclude-from=exclude centericq-4.20.0/src/icqface.cc centericq-4.20.0-patched/src/icqface.cc --- centericq-4.20.0/src/icqface.cc 2005-02-03 00:26:11.000000000 +0100 +++ centericq-4.20.0-patched/src/icqface.cc 2005-02-09 11:24:51.000000000 +0100 @@ -2869,25 +2869,48 @@ } void icqface::histmake(const vector &hist) { - vector::const_reverse_iterator i; + phistoryevents = &hist; + historydisplayoptions = hdoShowTimestamps; + compute_history(); + mhist.setpos(hist.size()); +} + +void icqface::compute_history() { + vector::const_iterator i; + const vector &hist = *phistoryevents; string text; time_t t, ts; char buf[64]; int color; + string ournickname; + if (historydisplayoptions & hdoShowContacts){ + ournickname = conf.getourid(passinfo.pname).nickname; + if (ournickname.empty()){ + ournickname = "me"; // for icq I don't know how to get my nickname + } + } mhist.clear(); - mhist.setpos(0); - for(i = hist.rbegin(); i != hist.rend(); ++i) { + for(i = hist.begin(); i != hist.end(); ++i) { imevent &ev = **i; color = 0; - - t = ev.gettimestamp(); - ts = ev.getsenttimestamp(); - text = (string) + " " + time2str(&t, "DD.MM hh:mm", buf) + " "; - if ((t - ts) > 0) - text += (string) + "[" + time2str(&ts, "DD.MM hh:mm", buf) + "] "; + if (historydisplayoptions & hdoShowTimestamps){ + t = ev.gettimestamp(); + ts = ev.getsenttimestamp(); + text = (string) + " " + time2str(&t, "DD.MM hh:mm", buf) + " "; + if ((t - ts) > 0) + text += (string) + "[" + time2str(&ts, "DD.MM hh:mm", buf) + "] "; + } + if (historydisplayoptions & hdoShowContacts) + if(ev.getdirection() == imevent::incoming){ + icqcontact *c = clist.get(ev.getcontact()); // not very optimized + if(!c) text += "unknown: "; + else text += c->getdispnick() + ": "; + } + else if(ev.getdirection() == imevent::outgoing) + text += ournickname + ": "; text += ev.gettext(); if(ev.getdirection() == imevent::incoming) { @@ -2903,16 +2926,37 @@ bool icqface::histexec(imevent *&im) { dialogbox db; bool r, fin; + static bool fullscreen = false; int k; static string sub; + struct {int x1,y1,x2,y2;} coords = { 0, 1, COLS, LINES-1 }; char buf[512]; + const char* status_text; r = fin = false; if(!mhist.empty()) { - db.setwindow(new textwindow(sizeWArea.x1+1, sizeWArea.y1+2, sizeWArea.x2, - sizeWArea.y2, conf.getcolor(cp_main_text), TW_NOBORDER)); - + if (fullscreen){ + blockmainscreen(); + coords.x1 = 0; coords.y1 = 1; coords.x2 = COLS; coords.y2 = LINES-1; + status_text = "%s search, %s again, %s cancel %s windowed %s show/hide nicknames"; + } + else { + coords.x1 = sizeWArea.x1+1; coords.y1 = sizeWArea.y1+1; coords.x2 = sizeWArea.x2; coords.y2 = sizeWArea.y2; + status_text = "%s search, %s again, %s cancel %s fullscreen %s show/hide nicknames"; + } + + status(_(status_text), + getstatkey(key_search, section_history).c_str(), + getstatkey(key_search_again, section_history).c_str(), + getstatkey(key_quit, section_editor).c_str(), + getstatkey(key_fullscreen, section_history).c_str(), + getstatkey(key_show_contacts, section_history).c_str()); + textwindow outerwindow(coords.x1, coords.y1, coords.x2, coords.y1+1, conf.getcolor(cp_main_text), TW_NOBORDER); + outerwindow.open(); + + textwindow window(coords.x1, coords.y1+1, coords.x2, coords.y2, conf.getcolor(cp_main_text), TW_NOBORDER); + db.setwindow(&window, false); db.setmenu(&mhist, false); /* @@ -2944,12 +2988,11 @@ im->getcontact().totext().c_str(), mhist.getcount()); - mainw.write(sizeWArea.x1+2, sizeWArea.y1, conf.getcolor(cp_main_highlight), buf); - - status(_("%s search, %s again, %s cancel"), - getstatkey(key_search, section_history).c_str(), - getstatkey(key_search_again, section_history).c_str(), - getstatkey(key_quit, section_editor).c_str()); + /* make a line */ + attrset(conf.getcolor(cp_main_frame)); + mvhline(coords.y1+1, coords.x1, HLINE, coords.x2 - coords.x1); + + outerwindow.writef(1, 0, conf.getcolor(cp_main_highlight), buf); while(!fin) { if(db.open(k)) { @@ -2959,7 +3002,7 @@ if(input.getlastkey() == KEY_ESC) break; case -3: if(!sub.empty()) - for(k = mhist.getpos()+1; k < mhist.getcount(); k++) { + for(k = mhist.getpos()-1; k >= 0; k--) { im = static_cast (mhist.getref(k)); if(im) if(im->contains(sub)) { @@ -2973,6 +3016,44 @@ fin = true; break; + case -5: + window.close(); + outerwindow.close(); + fullscreen = !fullscreen; + if (fullscreen){ + blockmainscreen(); + coords.x1 = 0; coords.y1 = 1; coords.x2 = COLS; coords.y2 = LINES-1; + status_text = "%s search, %s again, %s cancel %s windowed %s show/hide nicknames"; + } + else { + unblockmainscreen(); + coords.x1 = sizeWArea.x1+1; coords.y1 = sizeWArea.y1+1; coords.x2 = sizeWArea.x2; coords.y2 = sizeWArea.y2; + status_text = "%s search, %s again, %s cancel %s fullscreen %s show/hide nicknames"; + } + outerwindow.setcoords(coords.x1, coords.y1, coords.x2, coords.y1+1); + outerwindow.open(); + + window.setcoords(coords.x1, coords.y1+1, coords.x2, coords.y2); + + db.redraw(); + + /* make a line */ + attrset(conf.getcolor(cp_main_frame)); + mvhline(coords.y1+1, coords.x1, HLINE, coords.x2 - coords.x1); + + outerwindow.writef(1, 0, conf.getcolor(cp_main_highlight), + _("History for %s, %d events total"), + im->getcontact().totext().c_str(), mhist.getcount()); + break; + + case -6: + historydisplayoptions = (historydisplayoptions ^ hdoShowContacts); + compute_history(); + db.redraw(); + /* make a line */ + attrset(conf.getcolor(cp_main_frame)); + mvhline(coords.y1+1, coords.x1, HLINE, coords.x2 - coords.x1); + break; default: if(mhist.getref(k-1)) { im = static_cast (mhist.getref(k-1)); @@ -2985,9 +3066,12 @@ fin = true; } } - + db.close(); restoreworkarea(); + window.close(); + outerwindow.close(); + if (fullscreen) unblockmainscreen(); } return r; @@ -3296,6 +3380,10 @@ return -3; case key_quit: return -4; + case key_fullscreen: + return -5; + case key_show_contacts: + return -6; } return -1; diff -ru --exclude-from=exclude centericq-4.20.0/src/icqface.h centericq-4.20.0-patched/src/icqface.h --- centericq-4.20.0/src/icqface.h 2005-02-03 00:30:25.000000000 +0100 +++ centericq-4.20.0-patched/src/icqface.h 2005-02-09 10:13:21.000000000 +0100 @@ -38,6 +38,11 @@ add, prev, eventviewresult_size }; + enum historydisplayoptions{ + hdoShowContacts = 0x1, + hdoShowTimestamps = 0x2 + }; + enum transferstatus { tsInit, tsStart, @@ -104,7 +109,8 @@ }; vector transfers; - + const vector *phistoryevents; + unsigned int historydisplayoptions; protected: static int editmsgkeys(texteditor &e, int k); static int editaboutkeys(texteditor &e, int k); @@ -173,6 +179,8 @@ void peerinfo(int line, const imcontact &ic); void findpgpkey(dialogbox &db, const vector &items); + void compute_history(); + public: int extk; vector muins;