View | Details | Raw Unified | Return to bug 205284 | Differences between
and this patch

Collapse All | Expand All

(-)mutt-1.5.24/compose.c (-16 / +16 lines)
Lines 83-89 Link Here
83
83
84
#define HDR_XOFFSET 14
84
#define HDR_XOFFSET 14
85
#define TITLE_FMT "%14s" /* Used for Prompts, which are ASCII */
85
#define TITLE_FMT "%14s" /* Used for Prompts, which are ASCII */
86
#define W (COLS - HDR_XOFFSET)
86
#define W (COLS - HDR_XOFFSET - SidebarWidth)
87
87
88
static const char * const Prompts[] =
88
static const char * const Prompts[] =
89
{
89
{
Lines 144-150 Link Here
144
144
145
static void redraw_crypt_lines (HEADER *msg)
145
static void redraw_crypt_lines (HEADER *msg)
146
{
146
{
147
  mvprintw (HDR_CRYPT, 0, TITLE_FMT, "Security: ");
147
  mvprintw (HDR_CRYPT, SidebarWidth, TITLE_FMT, "Security: ");
148
148
149
  if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
149
  if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
150
  {
150
  {
Lines 179-185 Link Here
179
      addstr (_(" (OppEnc mode)"));
179
      addstr (_(" (OppEnc mode)"));
180
180
181
  clrtoeol ();
181
  clrtoeol ();
182
  move (HDR_CRYPTINFO, 0);
182
  move (HDR_CRYPTINFO, SidebarWidth);
183
  clrtoeol ();
183
  clrtoeol ();
184
184
185
  if ((WithCrypto & APPLICATION_PGP)
185
  if ((WithCrypto & APPLICATION_PGP)
Lines 204-210 Link Here
204
      && (msg->security & ENCRYPT)
204
      && (msg->security & ENCRYPT)
205
      && SmimeCryptAlg
205
      && SmimeCryptAlg
206
      && *SmimeCryptAlg) {
206
      && *SmimeCryptAlg) {
207
      mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
207
      mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "),
208
		NONULL(SmimeCryptAlg));
208
		NONULL(SmimeCryptAlg));
209
  }
209
  }
210
}
210
}
Lines 217-223 Link Here
217
  int c;
217
  int c;
218
  char *t;
218
  char *t;
219
219
220
  mvprintw (HDR_MIX, 0, TITLE_FMT, "Mix: ");
220
  mvprintw (HDR_MIX, SidebarWidth, TITLE_FMT, "Mix: ");
221
221
222
  if (!chain)
222
  if (!chain)
223
  {
223
  {
Lines 232-238 Link Here
232
    if (t && t[0] == '0' && t[1] == '\0')
232
    if (t && t[0] == '0' && t[1] == '\0')
233
      t = "<random>";
233
      t = "<random>";
234
    
234
    
235
    if (c + mutt_strlen (t) + 2 >= COLS)
235
    if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth)
236
      break;
236
      break;
237
237
238
    addstr (NONULL(t));
238
    addstr (NONULL(t));
Lines 284-290 Link Here
284
284
285
  buf[0] = 0;
285
  buf[0] = 0;
286
  rfc822_write_address (buf, sizeof (buf), addr, 1);
286
  rfc822_write_address (buf, sizeof (buf), addr, 1);
287
  mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]);
287
  mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]);
288
  mutt_paddstr (W, buf);
288
  mutt_paddstr (W, buf);
289
}
289
}
290
290
Lines 302-322 Link Here
302
  }
302
  }
303
  else
303
  else
304
  {
304
  {
305
    mvprintw (HDR_TO, 0, TITLE_FMT , Prompts[HDR_NEWSGROUPS - 1]);
305
    mvprintw (HDR_TO, SidebarWidth, TITLE_FMT , Prompts[HDR_NEWSGROUPS - 1]);
306
    mutt_paddstr (W, NONULL (msg->env->newsgroups));
306
    mutt_paddstr (W, NONULL (msg->env->newsgroups));
307
    mvprintw (HDR_CC, 0, TITLE_FMT , Prompts[HDR_FOLLOWUPTO - 1]);
307
    mvprintw (HDR_CC, SidebarWidth, TITLE_FMT , Prompts[HDR_FOLLOWUPTO - 1]);
308
    mutt_paddstr (W, NONULL (msg->env->followup_to));
308
    mutt_paddstr (W, NONULL (msg->env->followup_to));
309
    if (option (OPTXCOMMENTTO))
309
    if (option (OPTXCOMMENTTO))
310
    {
310
    {
311
      mvprintw (HDR_BCC, 0, TITLE_FMT , Prompts[HDR_XCOMMENTTO - 1]);
311
      mvprintw (HDR_BCC, SidebarWidth, TITLE_FMT , Prompts[HDR_XCOMMENTTO - 1]);
312
      mutt_paddstr (W, NONULL (msg->env->x_comment_to));
312
      mutt_paddstr (W, NONULL (msg->env->x_comment_to));
313
    }
313
    }
314
  }
314
  }
315
#endif
315
#endif
316
  mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
316
  mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
317
  mutt_paddstr (W, NONULL (msg->env->subject));
317
  mutt_paddstr (W, NONULL (msg->env->subject));
318
  draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
318
  draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
319
  mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
319
  mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]);
320
  mutt_paddstr (W, fcc);
320
  mutt_paddstr (W, fcc);
321
321
322
  if (WithCrypto)
322
  if (WithCrypto)
Lines 327-333 Link Here
327
#endif
327
#endif
328
328
329
  SETCOLOR (MT_COLOR_STATUS);
329
  SETCOLOR (MT_COLOR_STATUS);
330
  mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
330
  mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments"));
331
  clrtoeol ();
331
  clrtoeol ();
332
332
333
  NORMAL_COLOR;
333
  NORMAL_COLOR;
Lines 363-369 Link Here
363
  /* redraw the expanded list so the user can see the result */
363
  /* redraw the expanded list so the user can see the result */
364
  buf[0] = 0;
364
  buf[0] = 0;
365
  rfc822_write_address (buf, sizeof (buf), *addr, 1);
365
  rfc822_write_address (buf, sizeof (buf), *addr, 1);
366
  move (line, HDR_XOFFSET);
366
  move (line, HDR_XOFFSET+SidebarWidth);
367
  mutt_paddstr (W, buf);
367
  mutt_paddstr (W, buf);
368
  
368
  
369
  return 0;
369
  return 0;
Lines 705-711 Link Here
705
	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
705
	if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
706
	{
706
	{
707
	  mutt_str_replace (&msg->env->subject, buf);
707
	  mutt_str_replace (&msg->env->subject, buf);
708
	  move (HDR_SUBJECT, HDR_XOFFSET);
708
	  move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
709
	  if (msg->env->subject)
709
	  if (msg->env->subject)
710
	    mutt_paddstr (W, msg->env->subject);
710
	    mutt_paddstr (W, msg->env->subject);
711
	  else
711
	  else
Lines 723-729 Link Here
723
	{
723
	{
724
	  strfcpy (fcc, buf, fcclen);
724
	  strfcpy (fcc, buf, fcclen);
725
	  mutt_pretty_mailbox (fcc, fcclen);
725
	  mutt_pretty_mailbox (fcc, fcclen);
726
	  move (HDR_FCC, HDR_XOFFSET);
726
	  move (HDR_FCC, HDR_XOFFSET + SidebarWidth);
727
	  mutt_paddstr (W, fcc);
727
	  mutt_paddstr (W, fcc);
728
	  fccSet = 1;
728
	  fccSet = 1;
729
	}
729
	}
(-)tmp/sidebar.c (+419 lines)
Added Link Here
1
/*
2
 * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
3
 * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
4
 * 
5
 *     This program is free software; you can redistribute it and/or modify
6
 *     it under the terms of the GNU General Public License as published by
7
 *     the Free Software Foundation; either version 2 of the License, or
8
 *     (at your option) any later version.
9
 * 
10
 *     This program is distributed in the hope that it will be useful,
11
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *     GNU General Public License for more details.
14
 * 
15
 *     You should have received a copy of the GNU General Public License
16
 *     along with this program; if not, write to the Free Software
17
 *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
18
 */ 
19
20
21
#if HAVE_CONFIG_H
22
# include "config.h"
23
#endif
24
25
#include "mutt.h"
26
#include "mutt_menu.h"
27
#include "mutt_curses.h"
28
#include "sidebar.h"
29
#include "buffy.h"
30
#include <libgen.h>
31
#include "keymap.h"
32
#include <stdbool.h>
33
34
/*BUFFY *CurBuffy = 0;*/
35
static BUFFY *TopBuffy = 0;
36
static BUFFY *BottomBuffy = 0;
37
static int known_lines = 0;
38
39
void calc_boundaries() {
40
41
    BUFFY *tmp = Incoming;
42
43
	int count = LINES - 2 - (option(OPTHELP) ? 1 : 0);
44
45
	if ( known_lines != LINES ) {
46
		TopBuffy = BottomBuffy = 0;
47
		known_lines = LINES;
48
	}
49
	for ( ; tmp->next != 0; tmp = tmp->next )
50
		tmp->next->prev = tmp;
51
52
	if ( TopBuffy == 0 && BottomBuffy == 0 )
53
		TopBuffy = Incoming;
54
	if ( BottomBuffy == 0 ) {
55
		BottomBuffy = TopBuffy;
56
		while ( --count && BottomBuffy->next )
57
			BottomBuffy = BottomBuffy->next;
58
	}
59
	else if ( TopBuffy == CurBuffy->next ) {
60
		BottomBuffy = CurBuffy;
61
		tmp = BottomBuffy;
62
		while ( --count && tmp->prev)
63
			tmp = tmp->prev;
64
		TopBuffy = tmp;
65
	}
66
	else if ( BottomBuffy == CurBuffy->prev ) {
67
		TopBuffy = CurBuffy;
68
		tmp = TopBuffy;
69
		while ( --count && tmp->next )
70
			tmp = tmp->next;
71
		BottomBuffy = tmp;
72
	}
73
}
74
75
static const char *
76
sidebar_format_str (char *dest,
77
			size_t destlen,
78
			size_t col,
79
			char op,
80
			const char *src,
81
			const char *prefix,
82
			const char *ifstring,
83
			const char *elsestring,
84
			unsigned long data,
85
			format_flag flags)
86
{
87
/* casting from unsigned long - srsly?! */
88
struct sidebar_entry *sbe = (struct sidebar_entry *) data;
89
unsigned int optional;
90
char fmt[SHORT_STRING], buf[SHORT_STRING];
91
92
optional = flags & M_FORMAT_OPTIONAL;
93
94
switch(op) {
95
	case 'F':
96
		if(!optional) {
97
			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
98
			snprintf (dest, destlen, fmt, sbe->flagged);
99
		} else if(sbe->flagged == 0) {
100
			optional = 0;
101
		}
102
		break;
103
104
	case '!':
105
		if(sbe->flagged == 0)
106
			mutt_format_s(dest, destlen, prefix, "");
107
		if(sbe->flagged == 1)
108
			mutt_format_s(dest, destlen, prefix, "!");
109
		if(sbe->flagged == 2)
110
			mutt_format_s(dest, destlen, prefix, "!!");
111
		if(sbe->flagged > 2) {
112
			snprintf (buf, sizeof (buf), "%d!", sbe->flagged);
113
			mutt_format_s(dest, destlen, prefix, buf);
114
		}
115
		break;
116
117
	case 'S':
118
                if(!optional) {
119
		    snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
120
		    snprintf (dest, destlen, fmt, sbe->size);
121
                } else if (sbe->size == 0) {
122
                    optional = 0;
123
                }
124
		break;
125
126
	case 'N':
127
		if(!optional) {
128
			snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
129
			snprintf (dest, destlen, fmt, sbe->new);
130
		} else if(sbe->new == 0) {
131
			optional = 0;
132
		}
133
		break;
134
135
	case 'B':
136
		mutt_format_s(dest, destlen, prefix, sbe->box);
137
		break;
138
	}
139
140
	if(optional)
141
		mutt_FormatString (dest, destlen, col, ifstring, sidebar_format_str, (unsigned long) sbe, flags);
142
	else if (flags & M_FORMAT_OPTIONAL)
143
		mutt_FormatString (dest, destlen, col, elsestring, sidebar_format_str, (unsigned long) sbe, flags);
144
145
	return (src);
146
}
147
148
char *make_sidebar_entry(char *box, unsigned int size, unsigned int new, unsigned int flagged) {
149
    static char *entry = 0;
150
    struct sidebar_entry sbe;
151
    int SBvisual;
152
153
    SBvisual = SidebarWidth - strlen(SidebarDelim);
154
    if (SBvisual < 1)
155
        return NULL;
156
157
    sbe.new = new;
158
    sbe.flagged = flagged;
159
    sbe.size = size;
160
    strncpy(sbe.box, box, SHORT_STRING-1);
161
162
    safe_realloc(&entry, SBvisual + 2);
163
    entry[SBvisual + 1] = '\0';
164
165
    mutt_FormatString (entry, SBvisual+1, 0, SidebarFormat, sidebar_format_str, (unsigned long) &sbe, 0);
166
167
    return entry;
168
}
169
170
void set_curbuffy(char buf[LONG_STRING])
171
{
172
  BUFFY* tmp = CurBuffy = Incoming;
173
174
  if (!Incoming)
175
    return;
176
177
  while(1) {
178
    if(!strcmp(tmp->path, buf) || !strcmp(tmp->realpath, buf)) {
179
      CurBuffy = tmp;
180
      break;
181
    }
182
183
    if(tmp->next)
184
      tmp = tmp->next;
185
    else
186
      break;
187
  }
188
}
189
190
int draw_sidebar(int menu) {
191
192
	BUFFY *tmp;
193
#ifndef USE_SLANG_CURSES
194
        attr_t attrs;
195
#endif
196
        short delim_len = strlen(SidebarDelim);
197
        short color_pair;
198
199
        static bool initialized = false;
200
        static int prev_show_value;
201
        static short saveSidebarWidth;
202
        int lines = 0;
203
        int SidebarHeight;
204
        
205
        if(option(OPTSTATUSONTOP) || option(OPTHELP))
206
                lines++; /* either one will occupy the first line */
207
208
        /* initialize first time */
209
        if(!initialized) {
210
                prev_show_value = option(OPTSIDEBAR);
211
                saveSidebarWidth = SidebarWidth;
212
                if(!option(OPTSIDEBAR)) SidebarWidth = 0;
213
                initialized = true;
214
        }
215
216
        /* save or restore the value SidebarWidth */
217
        if(prev_show_value != option(OPTSIDEBAR)) {
218
                if(prev_show_value && !option(OPTSIDEBAR)) {
219
                        saveSidebarWidth = SidebarWidth;
220
                        SidebarWidth = 0;
221
                } else if(!prev_show_value && option(OPTSIDEBAR)) {
222
                        mutt_buffy_check(1); /* we probably have bad or no numbers */
223
                        SidebarWidth = saveSidebarWidth;
224
                }
225
                prev_show_value = option(OPTSIDEBAR);
226
        }
227
228
229
/*	if ( SidebarWidth == 0 ) return 0; */
230
       if (SidebarWidth > 0 && option (OPTSIDEBAR)
231
           && delim_len >= SidebarWidth) {
232
         unset_option (OPTSIDEBAR);
233
         /* saveSidebarWidth = SidebarWidth; */
234
         if (saveSidebarWidth > delim_len) {
235
           SidebarWidth = saveSidebarWidth;
236
           mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
237
           sleep (2);
238
         } else {
239
           SidebarWidth = 0;
240
           mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value."));
241
           sleep (4); /* the advise to set a sane value should be seen long enough */
242
         }
243
         saveSidebarWidth = 0;
244
         return (0);
245
       }
246
247
    if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) {
248
      if (SidebarWidth > 0) {
249
        saveSidebarWidth = SidebarWidth;
250
        SidebarWidth = 0;
251
      }
252
      unset_option(OPTSIDEBAR);
253
      return 0;
254
    }
255
256
        /* get attributes for divider */
257
	SETCOLOR(MT_COLOR_STATUS);
258
#ifndef USE_SLANG_CURSES
259
        attr_get(&attrs, &color_pair, 0);
260
#else
261
        color_pair = attr_get();
262
#endif
263
	SETCOLOR(MT_COLOR_NORMAL);
264
265
	/* draw the divider */
266
267
	SidebarHeight =  LINES - 1;
268
	if(option(OPTHELP) || !option(OPTSTATUSONTOP))
269
		SidebarHeight--;
270
271
	for ( ; lines < SidebarHeight; lines++ ) {
272
		move(lines, SidebarWidth - delim_len);
273
		addstr(NONULL(SidebarDelim));
274
#ifndef USE_SLANG_CURSES
275
                mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL);
276
#endif
277
	}
278
279
	if ( Incoming == 0 ) return 0;
280
        lines = 0;
281
        if(option(OPTSTATUSONTOP) || option(OPTHELP))
282
                lines++; /* either one will occupy the first line */
283
284
	if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) 
285
		calc_boundaries(menu);
286
	if ( CurBuffy == 0 ) CurBuffy = Incoming;
287
288
	tmp = TopBuffy;
289
290
	SETCOLOR(MT_COLOR_NORMAL);
291
292
	for ( ; tmp && lines < SidebarHeight; tmp = tmp->next ) {
293
		if ( tmp == CurBuffy )
294
			SETCOLOR(MT_COLOR_INDICATOR);
295
		else if ( tmp->msg_unread > 0 )
296
			SETCOLOR(MT_COLOR_NEW);
297
		else if ( tmp->msg_flagged > 0 )
298
		        SETCOLOR(MT_COLOR_FLAGGED);
299
		else
300
			SETCOLOR(MT_COLOR_NORMAL);
301
302
		move( lines, 0 );
303
		if ( Context && Context->path &&
304
                        (!strcmp(tmp->path, Context->path)||
305
			 !strcmp(tmp->realpath, Context->path)) ) {
306
			tmp->msg_unread = Context->unread;
307
			tmp->msgcount = Context->msgcount;
308
			tmp->msg_flagged = Context->flagged;
309
		}
310
		/* check whether Maildir is a prefix of the current folder's path */
311
		short maildir_is_prefix = 0;
312
		if ( (strlen(tmp->path) > strlen(Maildir)) &&
313
			(strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) )
314
        		maildir_is_prefix = 1;
315
		/* calculate depth of current folder and generate its display name with indented spaces */
316
		int sidebar_folder_depth = 0;
317
		char *sidebar_folder_name;
318
		sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ?  mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + ((Maildir[strlen(Maildir) - 1] == '/' || Maildir[strlen(Maildir) - 1] == '}') ?  0 : 1));
319
		/* sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ? mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + 1); */
320
		if ( maildir_is_prefix && option(OPTSIDEBARFOLDERINDENT) ) {
321
			char *tmp_folder_name;
322
			char *tmp_folder_name_dot;
323
			char *tmp_folder_name_slash;
324
			int i;
325
			tmp_folder_name = tmp->path + strlen(Maildir) + 1;
326
			for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
327
 				if (tmp_folder_name[i] == '/'  || tmp_folder_name[i] == '.') sidebar_folder_depth++;
328
			}   
329
			if (sidebar_folder_depth > 0) {
330
 				if (option(OPTSIDEBARSHORTPATH)) {
331
 					tmp_folder_name_dot = strrchr(tmp->path, '.');
332
 					tmp_folder_name_slash = strrchr(tmp->path, '/');
333
					if (tmp_folder_name_dot == NULL && tmp_folder_name_slash == NULL)
334
  						tmp_folder_name = mutt_basename(tmp->path);
335
 					tmp_folder_name = strrchr(tmp->path, '.');
336
 					if (tmp_folder_name == NULL)
337
 						tmp_folder_name = mutt_basename(tmp->path);
338
                                        else if (tmp_folder_name_dot > tmp_folder_name_slash)
339
                                                tmp_folder_name = tmp_folder_name_dot + 1;
340
                                        else
341
                                                tmp_folder_name = tmp_folder_name_slash + 1;
342
 				}
343
 				else
344
 					tmp_folder_name = tmp->path + strlen(Maildir) + ((Maildir[strlen(Maildir) - 1] == '/' || Maildir[strlen(Maildir) - 1] == '}') ?  0 : 1);
345
 				sidebar_folder_name = malloc(strlen(tmp_folder_name) + sidebar_folder_depth*strlen(NONULL(SidebarIndentStr)) + 1);
346
				sidebar_folder_name[0]=0;
347
				for (i=0; i < sidebar_folder_depth; i++)
348
					strncat(sidebar_folder_name, NONULL(SidebarIndentStr), strlen(NONULL(SidebarIndentStr)));
349
				strncat(sidebar_folder_name, tmp_folder_name, strlen(tmp_folder_name));
350
			}
351
		}
352
		printw( "%.*s", SidebarWidth - delim_len + 1,
353
			make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
354
			tmp->msg_unread, tmp->msg_flagged));
355
		if (sidebar_folder_depth > 0)
356
		        free(sidebar_folder_name);
357
		lines++;
358
	}
359
	SETCOLOR(MT_COLOR_NORMAL);
360
	for ( ; lines < SidebarHeight; lines++ ) {
361
		int i = 0;
362
		move( lines, 0 );
363
		for ( ; i < SidebarWidth - delim_len; i++ )
364
			addch(' ');
365
	}
366
	return 0;
367
}
368
369
370
void set_buffystats(CONTEXT* Context)
371
{
372
        BUFFY *tmp = Incoming;
373
        while(tmp) {
374
                if(Context && (!strcmp(tmp->path, Context->path) ||
375
                               !strcmp(tmp->realpath, Context->path))) {
376
			tmp->msg_unread = Context->unread;
377
			tmp->msgcount = Context->msgcount;
378
			tmp->msg_flagged = Context->flagged;
379
                        break;
380
                }
381
                tmp = tmp->next;
382
        }
383
}
384
385
void scroll_sidebar(int op, int menu)
386
{
387
        if(!SidebarWidth) return;
388
        if(!CurBuffy) return;
389
390
	switch (op) {
391
		case OP_SIDEBAR_NEXT:
392
			if ( CurBuffy->next == NULL ) return;
393
			CurBuffy = CurBuffy->next;
394
			break;
395
		case OP_SIDEBAR_PREV:
396
			if ( CurBuffy->prev == NULL ) return;
397
			CurBuffy = CurBuffy->prev;
398
			break;
399
		case OP_SIDEBAR_SCROLL_UP:
400
			CurBuffy = TopBuffy;
401
			if ( CurBuffy != Incoming ) {
402
				calc_boundaries(menu);
403
				CurBuffy = CurBuffy->prev;
404
			}
405
			break;
406
		case OP_SIDEBAR_SCROLL_DOWN:
407
			CurBuffy = BottomBuffy;
408
			if ( CurBuffy->next ) {
409
				calc_boundaries(menu);
410
				CurBuffy = CurBuffy->next;
411
			}
412
			break;
413
		default:
414
			return;
415
	}
416
	calc_boundaries(menu);
417
	draw_sidebar(menu);
418
}
419

Return to bug 205284