Search the web
Sign In
New User? Sign Up
gbuffy · GBuffy Tool Discussion
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
[PATCH] More userfriendly login + imap bug fix   Message List  
Reply | Forward Message #146 of 231 |
Here's a simple patch adding some user friendlyness to gbuffy's login
dialog and a vital imap bugfix.


o Make Enter in the login dialog submit the dialog.
(unfortunately, the password input box doesn't currently
automatically grab the keyboard focus yet)
o The imap code will happily increase the sequence counter
ad infinitum. With many mailboxes and a solid uptime, this
quickly overflows the SEQLEN constant (which is 4) and after
this, all imap communication stops working.

My fix is to let the sequence counter start over again as soon
as it reaches 10000.


Eivind


Tue Mar 9, 2004 8:13 am

eivindt@...
Send Email Send Email

diff -urN gbuffy-0.2.6/gbuffy.c ../../gbuffy-0.2.6-r1/work/gbuffy-0.2.6/gbuffy.c
--- gbuffy-0.2.6/gbuffy.c 2003-10-10 23:30:11.000000000 +0200
+++ ../../gbuffy-0.2.6-r1/work/gbuffy-0.2.6/gbuffy.c 2004-01-11
14:59:32.000000000 +0100
@@ -6,6 +6,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <gtk/gtk.h>
+#include <gdk/gdk.h>
#include <pwd.h>
#include <string.h>
#include <compface.h>
diff -urN gbuffy-0.2.6/gtklib.c ../../gbuffy-0.2.6-r1/work/gbuffy-0.2.6/gtklib.c
--- gbuffy-0.2.6/gtklib.c 2003-10-10 23:22:20.000000000 +0200
+++ ../../gbuffy-0.2.6-r1/work/gbuffy-0.2.6/gtklib.c 2004-01-07
10:12:57.000000000 +0100
@@ -2,9 +2,11 @@
#include <gtk/gtk.h>
#include <stdio.h>
#include <string.h>
+#include <gdk/gdkkeysyms.h>
#include "gtklib.h"
#include "gbuffy.h"

+
GtkWidget * create_option_menu (OptionMenuItem items[], gint num_items)
{
GtkWidget *menu;
@@ -99,6 +101,8 @@
int ok;
} PDIALOG;

+gboolean check_for_enter(GtkWidget *widget, GdkEventKey *event, PDIALOG* pd);
+
void pass_select_ok (GtkWidget *w, PDIALOG *pd)
{
pd->user = gtk_entry_get_text (GTK_ENTRY (pd->user_entry));
@@ -111,6 +115,7 @@
int password_prompt_dialog (char *prompt, char *user, size_t userlen,
char *pass, size_t passlen)
{
+ GtkWidget *ok;
GtkWidget *button;
GtkWidget *label;
GtkWidget *table;
@@ -124,12 +129,15 @@
destroy_sig = gtk_signal_connect (GTK_OBJECT (pd.dialog), "destroy",
(GtkSignalFunc) quit_dialog, &pd.dialog);

- button = gtk_button_new_with_label ("Ok");
+ ok = gtk_button_new_with_label ("Ok");
+ // Ok is the default button.
+ GTK_WIDGET_SET_FLAGS (ok, GTK_CAN_DEFAULT);
+
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (pd.dialog)->action_area),
- button, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (button),
+ ok, TRUE, TRUE, 0);
+ gtk_signal_connect (GTK_OBJECT (ok),
"clicked", (GtkSignalFunc) pass_select_ok, &pd);
- gtk_widget_show (button);
+ gtk_widget_show (ok);

button = gtk_button_new_with_label ("Cancel");
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (pd.dialog)->action_area),
@@ -139,6 +147,8 @@
GTK_OBJECT (pd.dialog));
gtk_widget_show (button);

+ gtk_widget_grab_default (ok);
+
gtk_window_set_title (GTK_WINDOW (pd.dialog), "Login Prompt");

label = gtk_label_new (prompt);
@@ -168,8 +178,16 @@
pd.pass_entry = gtk_entry_new_with_max_length (passlen);
gtk_entry_set_visibility (GTK_ENTRY (pd.pass_entry), FALSE);
gtk_entry_set_text (GTK_ENTRY (pd.pass_entry), pass);
+
+
+ gtk_signal_connect (GTK_OBJECT (pd.pass_entry),
+ "key-press-event", (GtkSignalFunc) check_for_enter,
+ &pd);
+
gtk_table_attach (GTK_TABLE (table), pd.pass_entry, 1, 2, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);
+
+
gtk_widget_show (pd.pass_entry);
gtk_widget_show (table);
gtk_widget_show (pd.dialog);
@@ -186,3 +204,13 @@
gtk_widget_destroy (pd.dialog);
return pd.ok;
}
+
+gboolean check_for_enter(GtkWidget *widget, GdkEventKey *event, PDIALOG *pd)
+{
+ if (event->keyval == GDK_Return) {
+ pass_select_ok(NULL, pd);
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
diff -urN gbuffy-0.2.6/imap.c ../../gbuffy-0.2.6-r1/work/gbuffy-0.2.6/imap.c
--- gbuffy-0.2.6/imap.c 2003-10-10 11:06:53.000000000 +0200
+++ ../../gbuffy-0.2.6-r1/work/gbuffy-0.2.6/imap.c 2004-03-09 09:02:12.641950968
+0100
@@ -71,6 +71,8 @@
static int sequence = 0;

snprintf (buf, buflen, "a%04d", sequence++);
+
+ sequence = sequence % 10000;
}


@@ -136,7 +138,8 @@
/* returns 1 if the command result was OK, or 0 if NO or BAD */
static int imap_code (const char *s)
{
- s += SEQLEN;
+// s += SEQLEN;
+ while (*s != ' ') s++;
SKIPWS (s);
return (strncasecmp ("OK", s, 2) == 0);
}
@@ -448,6 +451,7 @@
return (-1);
}

+
if (buf[0] == '*')
{
s = imap_next_word (buf);


Forward
Message #146 of 231 |
Expand Messages Author Sort by Date

Here's a simple patch adding some user friendlyness to gbuffy's login dialog and a vital imap bugfix. o Make Enter in the login dialog submit the dialog. ...
Eivind Tagseth
eivindt@...
Send Email
Mar 9, 2004
8:25 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help