Lines 2869-2893
Link Here
|
2869 |
} |
2869 |
} |
2870 |
|
2870 |
|
2871 |
void icqface::histmake(const vector<imevent *> &hist) { |
2871 |
void icqface::histmake(const vector<imevent *> &hist) { |
2872 |
vector<imevent *>::const_reverse_iterator i; |
2872 |
phistoryevents = &hist; |
|
|
2873 |
historydisplayoptions = hdoShowTimestamps; |
2874 |
compute_history(); |
2875 |
mhist.setpos(hist.size()); |
2876 |
} |
2877 |
|
2878 |
void icqface::compute_history() { |
2879 |
vector<imevent *>::const_iterator i; |
2880 |
const vector<imevent *> &hist = *phistoryevents; |
2873 |
string text; |
2881 |
string text; |
2874 |
time_t t, ts; |
2882 |
time_t t, ts; |
2875 |
char buf[64]; |
2883 |
char buf[64]; |
2876 |
int color; |
2884 |
int color; |
|
|
2885 |
string ournickname; |
2886 |
if (historydisplayoptions & hdoShowContacts){ |
2887 |
ournickname = conf.getourid(passinfo.pname).nickname; |
2888 |
if (ournickname.empty()){ |
2889 |
ournickname = "me"; // for icq I don't know how to get my nickname |
2890 |
} |
2891 |
} |
2877 |
|
2892 |
|
2878 |
mhist.clear(); |
2893 |
mhist.clear(); |
2879 |
mhist.setpos(0); |
|
|
2880 |
|
2894 |
|
2881 |
for(i = hist.rbegin(); i != hist.rend(); ++i) { |
2895 |
for(i = hist.begin(); i != hist.end(); ++i) { |
2882 |
imevent &ev = **i; |
2896 |
imevent &ev = **i; |
2883 |
|
2897 |
|
2884 |
color = 0; |
2898 |
color = 0; |
2885 |
|
2899 |
if (historydisplayoptions & hdoShowTimestamps){ |
2886 |
t = ev.gettimestamp(); |
2900 |
t = ev.gettimestamp(); |
2887 |
ts = ev.getsenttimestamp(); |
2901 |
ts = ev.getsenttimestamp(); |
2888 |
text = (string) + " " + time2str(&t, "DD.MM hh:mm", buf) + " "; |
2902 |
text = (string) + " " + time2str(&t, "DD.MM hh:mm", buf) + " "; |
2889 |
if ((t - ts) > 0) |
2903 |
if ((t - ts) > 0) |
2890 |
text += (string) + "[" + time2str(&ts, "DD.MM hh:mm", buf) + "] "; |
2904 |
text += (string) + "[" + time2str(&ts, "DD.MM hh:mm", buf) + "] "; |
|
|
2905 |
} |
2906 |
if (historydisplayoptions & hdoShowContacts) |
2907 |
if(ev.getdirection() == imevent::incoming){ |
2908 |
icqcontact *c = clist.get(ev.getcontact()); // not very optimized |
2909 |
if(!c) text += "unknown: "; |
2910 |
else text += c->getdispnick() + ": "; |
2911 |
} |
2912 |
else if(ev.getdirection() == imevent::outgoing) |
2913 |
text += ournickname + ": "; |
2891 |
text += ev.gettext(); |
2914 |
text += ev.gettext(); |
2892 |
|
2915 |
|
2893 |
if(ev.getdirection() == imevent::incoming) { |
2916 |
if(ev.getdirection() == imevent::incoming) { |
Lines 2903-2918
Link Here
|
2903 |
bool icqface::histexec(imevent *&im) { |
2926 |
bool icqface::histexec(imevent *&im) { |
2904 |
dialogbox db; |
2927 |
dialogbox db; |
2905 |
bool r, fin; |
2928 |
bool r, fin; |
|
|
2929 |
static bool fullscreen = false; |
2906 |
int k; |
2930 |
int k; |
2907 |
static string sub; |
2931 |
static string sub; |
|
|
2932 |
struct {int x1,y1,x2,y2;} coords = { 0, 1, COLS, LINES-1 }; |
2908 |
char buf[512]; |
2933 |
char buf[512]; |
|
|
2934 |
const char* status_text; |
2909 |
|
2935 |
|
2910 |
r = fin = false; |
2936 |
r = fin = false; |
2911 |
|
2937 |
|
2912 |
if(!mhist.empty()) { |
2938 |
if(!mhist.empty()) { |
2913 |
db.setwindow(new textwindow(sizeWArea.x1+1, sizeWArea.y1+2, sizeWArea.x2, |
2939 |
if (fullscreen){ |
2914 |
sizeWArea.y2, conf.getcolor(cp_main_text), TW_NOBORDER)); |
2940 |
blockmainscreen(); |
2915 |
|
2941 |
coords.x1 = 0; coords.y1 = 1; coords.x2 = COLS; coords.y2 = LINES-1; |
|
|
2942 |
status_text = "%s search, %s again, %s cancel %s windowed %s show/hide nicknames"; |
2943 |
} |
2944 |
else { |
2945 |
coords.x1 = sizeWArea.x1+1; coords.y1 = sizeWArea.y1+1; coords.x2 = sizeWArea.x2; coords.y2 = sizeWArea.y2; |
2946 |
status_text = "%s search, %s again, %s cancel %s fullscreen %s show/hide nicknames"; |
2947 |
} |
2948 |
|
2949 |
status(_(status_text), |
2950 |
getstatkey(key_search, section_history).c_str(), |
2951 |
getstatkey(key_search_again, section_history).c_str(), |
2952 |
getstatkey(key_quit, section_editor).c_str(), |
2953 |
getstatkey(key_fullscreen, section_history).c_str(), |
2954 |
getstatkey(key_show_contacts, section_history).c_str()); |
2955 |
textwindow outerwindow(coords.x1, coords.y1, coords.x2, coords.y1+1, conf.getcolor(cp_main_text), TW_NOBORDER); |
2956 |
outerwindow.open(); |
2957 |
|
2958 |
textwindow window(coords.x1, coords.y1+1, coords.x2, coords.y2, conf.getcolor(cp_main_text), TW_NOBORDER); |
2959 |
db.setwindow(&window, false); |
2916 |
db.setmenu(&mhist, false); |
2960 |
db.setmenu(&mhist, false); |
2917 |
|
2961 |
|
2918 |
/* |
2962 |
/* |
Lines 2944-2955
Link Here
|
2944 |
im->getcontact().totext().c_str(), |
2988 |
im->getcontact().totext().c_str(), |
2945 |
mhist.getcount()); |
2989 |
mhist.getcount()); |
2946 |
|
2990 |
|
2947 |
mainw.write(sizeWArea.x1+2, sizeWArea.y1, conf.getcolor(cp_main_highlight), buf); |
2991 |
/* make a line */ |
2948 |
|
2992 |
attrset(conf.getcolor(cp_main_frame)); |
2949 |
status(_("%s search, %s again, %s cancel"), |
2993 |
mvhline(coords.y1+1, coords.x1, HLINE, coords.x2 - coords.x1); |
2950 |
getstatkey(key_search, section_history).c_str(), |
2994 |
|
2951 |
getstatkey(key_search_again, section_history).c_str(), |
2995 |
outerwindow.writef(1, 0, conf.getcolor(cp_main_highlight), buf); |
2952 |
getstatkey(key_quit, section_editor).c_str()); |
|
|
2953 |
|
2996 |
|
2954 |
while(!fin) { |
2997 |
while(!fin) { |
2955 |
if(db.open(k)) { |
2998 |
if(db.open(k)) { |
Lines 2959-2965
Link Here
|
2959 |
if(input.getlastkey() == KEY_ESC) break; |
3002 |
if(input.getlastkey() == KEY_ESC) break; |
2960 |
case -3: |
3003 |
case -3: |
2961 |
if(!sub.empty()) |
3004 |
if(!sub.empty()) |
2962 |
for(k = mhist.getpos()+1; k < mhist.getcount(); k++) { |
3005 |
for(k = mhist.getpos()-1; k >= 0; k--) { |
2963 |
im = static_cast<imevent *> (mhist.getref(k)); |
3006 |
im = static_cast<imevent *> (mhist.getref(k)); |
2964 |
if(im) |
3007 |
if(im) |
2965 |
if(im->contains(sub)) { |
3008 |
if(im->contains(sub)) { |
Lines 2973-2978
Link Here
|
2973 |
fin = true; |
3016 |
fin = true; |
2974 |
break; |
3017 |
break; |
2975 |
|
3018 |
|
|
|
3019 |
case -5: |
3020 |
window.close(); |
3021 |
outerwindow.close(); |
3022 |
fullscreen = !fullscreen; |
3023 |
if (fullscreen){ |
3024 |
blockmainscreen(); |
3025 |
coords.x1 = 0; coords.y1 = 1; coords.x2 = COLS; coords.y2 = LINES-1; |
3026 |
status_text = "%s search, %s again, %s cancel %s windowed %s show/hide nicknames"; |
3027 |
} |
3028 |
else { |
3029 |
unblockmainscreen(); |
3030 |
coords.x1 = sizeWArea.x1+1; coords.y1 = sizeWArea.y1+1; coords.x2 = sizeWArea.x2; coords.y2 = sizeWArea.y2; |
3031 |
status_text = "%s search, %s again, %s cancel %s fullscreen %s show/hide nicknames"; |
3032 |
} |
3033 |
outerwindow.setcoords(coords.x1, coords.y1, coords.x2, coords.y1+1); |
3034 |
outerwindow.open(); |
3035 |
|
3036 |
window.setcoords(coords.x1, coords.y1+1, coords.x2, coords.y2); |
3037 |
|
3038 |
db.redraw(); |
3039 |
|
3040 |
/* make a line */ |
3041 |
attrset(conf.getcolor(cp_main_frame)); |
3042 |
mvhline(coords.y1+1, coords.x1, HLINE, coords.x2 - coords.x1); |
3043 |
|
3044 |
outerwindow.writef(1, 0, conf.getcolor(cp_main_highlight), |
3045 |
_("History for %s, %d events total"), |
3046 |
im->getcontact().totext().c_str(), mhist.getcount()); |
3047 |
break; |
3048 |
|
3049 |
case -6: |
3050 |
historydisplayoptions = (historydisplayoptions ^ hdoShowContacts); |
3051 |
compute_history(); |
3052 |
db.redraw(); |
3053 |
/* make a line */ |
3054 |
attrset(conf.getcolor(cp_main_frame)); |
3055 |
mvhline(coords.y1+1, coords.x1, HLINE, coords.x2 - coords.x1); |
3056 |
break; |
2976 |
default: |
3057 |
default: |
2977 |
if(mhist.getref(k-1)) { |
3058 |
if(mhist.getref(k-1)) { |
2978 |
im = static_cast<imevent *> (mhist.getref(k-1)); |
3059 |
im = static_cast<imevent *> (mhist.getref(k-1)); |
Lines 2985-2993
Link Here
|
2985 |
fin = true; |
3066 |
fin = true; |
2986 |
} |
3067 |
} |
2987 |
} |
3068 |
} |
2988 |
|
3069 |
|
2989 |
db.close(); |
3070 |
db.close(); |
2990 |
restoreworkarea(); |
3071 |
restoreworkarea(); |
|
|
3072 |
window.close(); |
3073 |
outerwindow.close(); |
3074 |
if (fullscreen) unblockmainscreen(); |
2991 |
} |
3075 |
} |
2992 |
|
3076 |
|
2993 |
return r; |
3077 |
return r; |
Lines 3296-3301
Link Here
|
3296 |
return -3; |
3380 |
return -3; |
3297 |
case key_quit: |
3381 |
case key_quit: |
3298 |
return -4; |
3382 |
return -4; |
|
|
3383 |
case key_fullscreen: |
3384 |
return -5; |
3385 |
case key_show_contacts: |
3386 |
return -6; |
3299 |
} |
3387 |
} |
3300 |
|
3388 |
|
3301 |
return -1; |
3389 |
return -1; |