- Use useful variable in init
- We don't need to use Context since s is already the path we want
Signed-off-by: Julien Danjou <julien@danjou.info>
Signed-off-by: Pierre Habouzit <madcoder@madism.org>
+/* Return the index number of path in Incoming list */
int buffy_lookup (const char* path) {
int i = 0;
int buffy_lookup (const char* path) {
int i = 0;
if (list_empty(Incoming) || !path || !*path)
return (-1);
if (list_empty(Incoming) || !path || !*path)
return (-1);
for (i = 0; i < Incoming->length; i++) {
for (i = 0; i < Incoming->length; i++) {
- if (!m_strcmp(((BUFFY*)Incoming->data[i])->path, path) )
+ if (!m_strcmp(((BUFFY *)Incoming->data[i])->path, path))
- * If buffy_lookup returns the index,
+ * buffy_lookup returns the index,
* or -1 if not found (-1..Incoming->length-1);
* plus one --> (0..Incoming->length).
* Modulo mapps it into the correct range.
*/
i = 1 + buffy_lookup (s);
* or -1 if not found (-1..Incoming->length-1);
* plus one --> (0..Incoming->length).
* Modulo mapps it into the correct range.
*/
i = 1 + buffy_lookup (s);
- for (l=0; l < Incoming->length; l++) {
+ for (l = 0; l < Incoming->length; l++) {
c = (l+i) % Incoming->length;
c = (l+i) % Incoming->length;
- if ((!Context || !Context->path || m_strcmp(((BUFFY*) Incoming->data[c])->path, Context->path)) &&
+
+ if (m_strcmp(((BUFFY*) Incoming->data[c])->path, s) &&
((BUFFY*) Incoming->data[c])->new > 0)
break;
}
((BUFFY*) Incoming->data[c])->new > 0)
break;
}
*s = '\0';
/* something went wrong since we're here when buffy_check
* reported new mail */
*s = '\0';
/* something went wrong since we're here when buffy_check
* reported new mail */
} else {
m_strcpy(s, slen, ((BUFFY*)Incoming->data[c])->path);
mutt_pretty_mailbox (s);
} else {
m_strcpy(s, slen, ((BUFFY*)Incoming->data[c])->path);
mutt_pretty_mailbox (s);
Maildirlength) == 0 &&
m_strlen(CurrentFolder) > Maildirlength) {
val = CurrentFolder + Maildirlength;
Maildirlength) == 0 &&
m_strlen(CurrentFolder) > Maildirlength) {
val = CurrentFolder + Maildirlength;
- if (Maildir[strlen(Maildir)-1]!='/')
+ if (Maildir[Maildirlength]!='/')
val += 1;
/* if not $folder, just use everything after last / */
} else if ((t = strrchr (CurrentFolder, '/')) != NULL)
val += 1;
/* if not $folder, just use everything after last / */
} else if ((t = strrchr (CurrentFolder, '/')) != NULL)