diff -ru --exclude-from=exclude centericq-4.20.0-orig/src/centericq.h centericq-4.20.0-patched/src/centericq.h --- centericq-4.20.0-orig/src/centericq.h 2004-06-12 16:09:27.000000000 +0200 +++ centericq-4.20.0-patched/src/centericq.h 2005-02-09 16:31:11.000000000 +0100 @@ -84,7 +84,8 @@ void readevents(const imcontact cont); void history(const imcontact &cont); - + bool next_chat(bool next = false); + bool sendevent(const imevent &ev, icqface::eventviewresult r); }; diff -ru --exclude-from=exclude centericq-4.20.0-orig/src/icqconf.cc centericq-4.20.0-patched/src/icqconf.cc --- centericq-4.20.0-orig/src/icqconf.cc 2005-01-27 00:52:47.000000000 +0100 +++ centericq-4.20.0-patched/src/icqconf.cc 2005-02-09 17:07:16.000000000 +0100 @@ -237,6 +237,8 @@ of << "bind contact\ti\tignore" << endl; of << "bind contact\t\\as\tquickfind" << endl; of << "bind contact\t/\tquickfind" << endl << endl; + of << "bind contact\t\\cn\tnext_chat" << endl; + of << "bind contact\t\\cb\tprev_chat" << endl; of << "bind history\t/\tsearch" << endl; of << "bind history\ts\tsearch" << endl; of << "bind history\tn\tsearch_again" << endl; @@ -246,6 +248,8 @@ of << "bind editor\t\tquit" << endl; of << "bind editor\t\\cp\tmultiple_recipients" << endl; of << "bind editor\t\\co\thistory" << endl; + of << "bind editor\t\\cn\tnext_chat" << endl; + of << "bind editor\t\\cb\tprev_chat" << endl; of << "bind editor\t\\a?\tinfo" << endl; of << "bind editor\t\tshow_urls" << endl; of << "bind editor\t\tfullscreen" << endl << endl; @@ -341,6 +345,8 @@ if(param == "quit") k.action = key_quit; else if(param == "change_status") k.action = key_change_status; else if(param == "history") k.action = key_history; else + if(param == "next_chat") k.action = key_next_chat; else + if(param == "prev_chat") k.action = key_prev_chat; else if(param == "fetch_away_message") k.action = key_fetch_away_message; else if(param == "user_menu") k.action = key_user_menu; else if(param == "general_menu") k.action = key_general_menu; else diff -ru --exclude-from=exclude centericq-4.20.0-orig/src/icqconf.h centericq-4.20.0-patched/src/icqconf.h --- centericq-4.20.0-orig/src/icqconf.h 2005-01-16 13:59:57.000000000 +0100 +++ centericq-4.20.0-patched/src/icqconf.h 2005-02-09 16:31:11.000000000 +0100 @@ -71,6 +71,8 @@ key_quickfind, key_search, key_search_again, + key_next_chat, + key_prev_chat, key_show_urls, key_rss_check, key_multiple_recipients, diff -ru --exclude-from=exclude centericq-4.20.0-orig/src/icqcontact.cc centericq-4.20.0-patched/src/icqcontact.cc --- centericq-4.20.0-orig/src/icqcontact.cc 2005-01-27 00:52:48.000000000 +0100 +++ centericq-4.20.0-patched/src/icqcontact.cc 2005-02-09 16:31:11.000000000 +0100 @@ -47,6 +47,7 @@ status = offline; finlist = true; congratulated = false; + openedforchat = false; for(ie = imevent::message; ie != imevent::imeventtype_size; ie++) sound[ie] = ""; diff -ru --exclude-from=exclude centericq-4.20.0-orig/src/icqcontact.h centericq-4.20.0-patched/src/icqcontact.h --- centericq-4.20.0-orig/src/icqcontact.h 2005-01-23 14:01:39.000000000 +0100 +++ centericq-4.20.0-patched/src/icqcontact.h 2005-02-09 16:31:11.000000000 +0100 @@ -70,7 +70,7 @@ imstatus status; int fupdated, groupid, fhistoffset; - bool finlist, congratulated, modified, fhasevents, usepgpkey; + bool finlist, congratulated, modified, fhasevents, usepgpkey, openedforchat; time_t lastread, lastseen, lasttyping; string sound[imevent::imeventtype_size]; @@ -122,6 +122,9 @@ bool hasevents() const { return fhasevents; } void sethasevents(bool n) { fhasevents = n; } + bool isopenedforchat() const { return openedforchat; } + bool setopenedforchat(bool n) { openedforchat = n; } + bool toggleopenedforchat() { openedforchat = !openedforchat; } string getnick() const; string getdispnick() const; diff -ru --exclude-from=exclude centericq-4.20.0-orig/src/icqface.cc centericq-4.20.0-patched/src/icqface.cc --- centericq-4.20.0-orig/src/icqface.cc 2005-02-03 00:26:11.000000000 +0100 +++ centericq-4.20.0-patched/src/icqface.cc 2005-02-09 17:05:37.000000000 +0100 @@ -447,9 +447,43 @@ return r; } +/* called to prepare the next chat contact, returns true if it found one, false otherwise + parameter is true if its next chat contact or false if is the previous + */ +bool icqface::next_chat(bool next) { + find_next_action = (next ? 1:-1); + if (last_selected) last_selected->setopenedforchat(false); + return true; +} + +icqcontact *icqface::find_next_chat() { + if (find_next_action == 0) return 0; + int i; + if (last_selected){ + for(i = 0; i < clist.count && clist.at(i) != last_selected; i++) + ; + i += find_next_action; + if (i <= 0) i = clist.count -1; + else if (i >= clist.count) i = 0; + } + else i = find_next_action == 1 ? 0 : clist.count -1; + + icqcontact *c; + for (; i < clist.count && i >= 0; i += find_next_action){ + c = (icqcontact *) clist.at(i); + if (c->isopenedforchat() || c->hasevents()) { + find_next_action = 0; + return c; + } + } + + find_next_action = 0; + return 0; +} + icqcontact *icqface::mainloop(int &action) { int i, curid; - icqcontact *c = 0; icqgroup *g; + icqcontact *c = 0, *c1 = 0; icqgroup *g; bool fin; for(fin = false; !fin; ) { @@ -457,8 +491,12 @@ /* Obtain the (icqcontact *) from the treeview. If a node is selected, throw out the contact and obtain the correct (icqgroup *). */ - - c = (icqcontact *) mcontacts->open(&i); + c = find_next_chat(); //check if next_chat was called from inside a chat window + if (!c){ + last_selected = 0; + c = (icqcontact *) mcontacts->open(&i); + if (c1 = find_next_chat()) c = c1; //check if next_chat was called from contacts menu + } if(mcontacts->isnode(i) && c) { c = 0; @@ -529,7 +567,7 @@ break; } } - + if (c) last_selected = c; return c; } @@ -2192,12 +2230,13 @@ void icqface::showeventbottom(const imcontact &ic) { const char *text = ischannel(ic) ? _("%s send, %s multi, %s history, %s URLs, %s expand, %s members, %s close") : - _("%s send, %s multi, %s history, %s URLs, %s expand, %s details, %s cancel"); + _("%s send, %s multi, %s history, %s next chat, %s URLs, %s expand, %s details, %s cancel"); status(text, getstatkey(key_send_message, section_editor).c_str(), getstatkey(key_multiple_recipients, section_editor).c_str(), getstatkey(key_history, section_editor).c_str(), + getstatkey(key_next_chat, section_editor).c_str(), getstatkey(key_show_urls, section_editor).c_str(), getstatkey(key_fullscreen, section_editor).c_str(), getstatkey(key_info, section_editor).c_str(), @@ -2620,6 +2659,7 @@ chatlastread = 0; inchat = true; passinfo = ic; + c->setopenedforchat(true); muins.clear(); muins.push_back(passinfo); @@ -2666,6 +2706,7 @@ c->setpostponed(editdone ? "" : p.get()); } + c->toggleopenedforchat(); c->save(); restoreworkarea(); status("@"); @@ -3196,6 +3237,16 @@ face.extk = ACT_HISTORY; break; + case key_next_chat: + face.extk = ACT_MSG; + face.next_chat(true); + break; + + case key_prev_chat: + face.extk = ACT_MSG; + face.next_chat(false); + break; + case key_add: face.extk = ACT_ADD; break; case key_send_contact: @@ -3323,6 +3374,14 @@ case key_history: cicq.history(face.passinfo); break; + case key_prev_chat: + face.editdone = false; + face.next_chat(false); + return -1; + case key_next_chat: + face.editdone = false; + face.next_chat(true); + return -1; case key_info: cicq.userinfo(face.passinfo); break; diff -ru --exclude-from=exclude centericq-4.20.0-orig/src/icqface.h centericq-4.20.0-patched/src/icqface.h --- centericq-4.20.0-orig/src/icqface.h 2005-02-03 00:30:25.000000000 +0100 +++ centericq-4.20.0-patched/src/icqface.h 2005-02-09 16:31:11.000000000 +0100 @@ -92,6 +92,9 @@ imcontact passinfo; const imevent *passevent; + + icqcontact *last_selected; + int find_next_action; struct filetransferitem { string fname; @@ -202,6 +205,10 @@ void relaxedupdate(); bool updaterequested(); + + icqcontact *find_next_chat(); + bool next_chat(bool next = true); + icqcontact *mainloop(int &action); void fillcontactlist();