Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/b46f1257c3db75cdaa0794f96e3802f4c13bb4e6
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/b46f1257c3db75cdaa0794f96e3802f4c13bb4e6
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/b46f1257c3db75cdaa0794f96e3802f4c13bb4e6

The branch, master has been updated
       via  b46f1257c3db75cdaa0794f96e3802f4c13bb4e6 (commit)
       via  7964629914cd955a48c3ed52e27cf79ee1ece3f6 (commit)
       via  122f09af5d1786d1c0b6ae6175e5eb91170dea7f (commit)
      from  7d22759f5ee22c839b943455369fa270dd884753 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=b46f1257c3db75cdaa0794f96e3802f4c13bb4e6
commit b46f1257c3db75cdaa0794f96e3802f4c13bb4e6
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Convert user/pass to UTF-8 for submission

diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index e4965e3..3ebae18 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -46,8 +46,10 @@
 
 #include "amiga/gui.h"
 #include "amiga/libs.h"
-#include "amiga/object.h"
 #include "amiga/login.h"
+#include "amiga/misc.h"
+#include "amiga/object.h"
+#include "amiga/utf8.h"
 
 enum {
        AMI_LOGIN_MSG_HOST,
@@ -78,7 +80,7 @@ static void ami_401login_close(void *w);
 
 static const struct ami_win_event_table ami_login_table = {
        ami_401login_event,
-       ami_401login_close,
+       ami_401login_close, /* TODO: investigate why this doesn't get called on 
exit */
 };
 
 nserror gui_401login_open(nsurl *url, const char *realm,
@@ -215,13 +217,20 @@ static void ami_401login_close(void *w)
 
 static void ami_401login_login(struct gui_login_window *lw)
 {
-       ULONG *user,*pass;
+       char *user;
+       char *pass;
 
        GetAttr(STRINGA_TextVal,lw->objects[GID_USER],(ULONG *)&user);
        GetAttr(STRINGA_TextVal,lw->objects[GID_PASS],(ULONG *)&pass);
 
-       /* TODO: Encoding conversion to UTF8 for `user` and `pass`? */
-       lw->cb(user, pass, lw->cbpw);
+       char *user_utf8 = ami_to_utf8_easy(user);
+       char *pass_utf8 = ami_to_utf8_easy(pass);
+
+       if(user_utf8 && pass_utf8) {
+               lw->cb(user_utf8, pass_utf8, lw->cbpw);
+       } else {
+               amiga_warn_user("NoMemory", "");
+       }
 
        /* Invalidate continuation */
        lw->cb = NULL;


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=7964629914cd955a48c3ed52e27cf79ee1ece3f6
commit 7964629914cd955a48c3ed52e27cf79ee1ece3f6
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Convert login UI strings from UTF-8 before display

diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index 9cdf795..e4965e3 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -49,6 +49,16 @@
 #include "amiga/object.h"
 #include "amiga/login.h"
 
+enum {
+       AMI_LOGIN_MSG_HOST,
+       AMI_LOGIN_MSG_REALM,
+       AMI_LOGIN_MSG_USER,
+       AMI_LOGIN_MSG_PASS,
+       AMI_LOGIN_MSG_LOGIN,
+       AMI_LOGIN_MSG_CANCEL,
+       AMI_LOGIN_MSG_MAX
+};
+
 struct gui_login_window {
        struct ami_generic_window w;
        struct Window *win;
@@ -60,10 +70,11 @@ struct gui_login_window {
        lwc_string *host;
        char uname[256];
        char pwd[256];
+       char *messages[AMI_LOGIN_MSG_MAX];
 };
 
 static BOOL ami_401login_event(void *w);
-static void ami_401login_close(void *w)
+static void ami_401login_close(void *w);
 
 static const struct ami_win_event_table ami_login_table = {
        ami_401login_event,
@@ -91,6 +102,13 @@ nserror gui_401login_open(nsurl *url, const char *realm,
        lw->cb = cb;
        lw->cbpw = cbpw;
 
+       lw->messages[AMI_LOGIN_MSG_HOST] = ami_utf8_easy(messages_get("Host"));
+       lw->messages[AMI_LOGIN_MSG_REALM] = 
ami_utf8_easy(messages_get("Realm"));
+       lw->messages[AMI_LOGIN_MSG_USER] = 
ami_utf8_easy(messages_get("Username"));
+       lw->messages[AMI_LOGIN_MSG_PASS] = 
ami_utf8_easy(messages_get("Password"));
+       lw->messages[AMI_LOGIN_MSG_LOGIN] = 
ami_utf8_easy(messages_get("Login"));
+       lw->messages[AMI_LOGIN_MSG_CANCEL] = 
ami_utf8_easy(messages_get("Cancel"));
+
        len = strlen(username);
        assert(len < sizeof(lw->uname));
        memcpy(lw->uname, username, len + 1);
@@ -115,12 +133,11 @@ nserror gui_401login_open(nsurl *url, const char *realm,
                WINDOW_Position, WPOS_CENTERSCREEN,
                WINDOW_ParentGroup, lw->objects[GID_MAIN] = LayoutVObj,
                                LAYOUT_AddChild, StringObj,
-                                       STRINGA_TextVal,
-                                       lwc_string_data(lw->host),
+                                       STRINGA_TextVal, 
lwc_string_data(lw->host),
                                        GA_ReadOnly,TRUE,
                                StringEnd,
                                CHILD_Label, LabelObj,
-                                       LABEL_Text,messages_get("Host"),
+                                       LABEL_Text, 
lw->messages[AMI_LOGIN_MSG_HOST],
                                LabelEnd,
                                CHILD_WeightedHeight,0,
                                LAYOUT_AddChild, StringObj,
@@ -128,7 +145,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
                                        GA_ReadOnly,TRUE,
                                StringEnd,
                                CHILD_Label, LabelObj,
-                                       LABEL_Text,messages_get("Realm"),
+                                       LABEL_Text, 
lw->messages[AMI_LOGIN_MSG_REALM],
                                LabelEnd,
                                CHILD_WeightedHeight,0,
                                LAYOUT_AddChild, lw->objects[GID_USER] = 
StringObj,
@@ -137,7 +154,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
                                        STRINGA_TextVal, lw->uname,
                                StringEnd,
                                CHILD_Label, LabelObj,
-                                       LABEL_Text,messages_get("Username"),
+                                       LABEL_Text, 
lw->messages[AMI_LOGIN_MSG_USER],
                                LabelEnd,
                                CHILD_WeightedHeight,0,
                                LAYOUT_AddChild, lw->objects[GID_PASS] = 
StringObj,
@@ -147,21 +164,21 @@ nserror gui_401login_open(nsurl *url, const char *realm,
                                        STRINGA_TextVal, lw->pwd,
                                StringEnd,
                                CHILD_Label, LabelObj,
-                                       LABEL_Text,messages_get("Password"),
+                                       LABEL_Text, 
lw->messages[AMI_LOGIN_MSG_PASS],
                                LabelEnd,
                                CHILD_WeightedHeight,0,
                                LAYOUT_AddChild, LayoutHObj,
                                        LAYOUT_AddChild, lw->objects[GID_LOGIN] 
= ButtonObj,
                                                GA_ID,GID_LOGIN,
                                                GA_RelVerify,TRUE,
-                                               GA_Text,messages_get("Login"),
+                                               GA_Text, 
lw->messages[AMI_LOGIN_MSG_LOGIN],
                                                GA_TabCycle,TRUE,
                                        ButtonEnd,
                                        CHILD_WeightedHeight,0,
                                        LAYOUT_AddChild, 
lw->objects[GID_CANCEL] = ButtonObj,
                                                GA_ID,GID_CANCEL,
                                                GA_RelVerify,TRUE,
-                                               GA_Text,messages_get("Cancel"),
+                                               GA_Text, 
lw->messages[AMI_LOGIN_MSG_CANCEL],
                                                GA_TabCycle,TRUE,
                                        ButtonEnd,
                                LayoutEnd,
@@ -187,6 +204,12 @@ static void ami_401login_close(void *w)
        lwc_string_unref(lw->host);
        nsurl_unref(lw->url);
        free(lw->realm);
+
+       /* Free local charset version of messages */
+       for(int i = 0; i < AMI_LOGIN_MSG_MAX; i++) {
+               ami_utf8_free(lw->messages[i]);
+       }
+
        ami_gui_win_list_remove(lw);
 }
 


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=122f09af5d1786d1c0b6ae6175e5eb91170dea7f
commit 122f09af5d1786d1c0b6ae6175e5eb91170dea7f
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Close login window if NetSurf quits

diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index 6735f93..9cdf795 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -63,11 +63,11 @@ struct gui_login_window {
 };
 
 static BOOL ami_401login_event(void *w);
+static void ami_401login_close(void *w)
 
 static const struct ami_win_event_table ami_login_table = {
        ami_401login_event,
-       NULL, /* we don't explicitly close the login window at all.
-                       @todo check if this prevents us from quitting NetSurf */
+       ami_401login_close,
 };
 
 nserror gui_401login_open(nsurl *url, const char *realm,
@@ -175,8 +175,10 @@ nserror gui_401login_open(nsurl *url, const char *realm,
        return NSERROR_OK;
 }
 
-static void ami_401login_close(struct gui_login_window *lw)
+static void ami_401login_close(void *w)
 {
+       struct gui_login_window *lw = (struct gui_login_window *)w;
+
        /* If continuation exists, then forbid refetch */
        if (lw->cb != NULL)
                lw->cb(NULL, NULL, lw->cbpw);


-----------------------------------------------------------------------

Summary of changes:
 frontends/amiga/login.c |   64 ++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 49 insertions(+), 15 deletions(-)

diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index 6735f93..3ebae18 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -46,8 +46,20 @@
 
 #include "amiga/gui.h"
 #include "amiga/libs.h"
-#include "amiga/object.h"
 #include "amiga/login.h"
+#include "amiga/misc.h"
+#include "amiga/object.h"
+#include "amiga/utf8.h"
+
+enum {
+       AMI_LOGIN_MSG_HOST,
+       AMI_LOGIN_MSG_REALM,
+       AMI_LOGIN_MSG_USER,
+       AMI_LOGIN_MSG_PASS,
+       AMI_LOGIN_MSG_LOGIN,
+       AMI_LOGIN_MSG_CANCEL,
+       AMI_LOGIN_MSG_MAX
+};
 
 struct gui_login_window {
        struct ami_generic_window w;
@@ -60,14 +72,15 @@ struct gui_login_window {
        lwc_string *host;
        char uname[256];
        char pwd[256];
+       char *messages[AMI_LOGIN_MSG_MAX];
 };
 
 static BOOL ami_401login_event(void *w);
+static void ami_401login_close(void *w);
 
 static const struct ami_win_event_table ami_login_table = {
        ami_401login_event,
-       NULL, /* we don't explicitly close the login window at all.
-                       @todo check if this prevents us from quitting NetSurf */
+       ami_401login_close, /* TODO: investigate why this doesn't get called on 
exit */
 };
 
 nserror gui_401login_open(nsurl *url, const char *realm,
@@ -91,6 +104,13 @@ nserror gui_401login_open(nsurl *url, const char *realm,
        lw->cb = cb;
        lw->cbpw = cbpw;
 
+       lw->messages[AMI_LOGIN_MSG_HOST] = ami_utf8_easy(messages_get("Host"));
+       lw->messages[AMI_LOGIN_MSG_REALM] = 
ami_utf8_easy(messages_get("Realm"));
+       lw->messages[AMI_LOGIN_MSG_USER] = 
ami_utf8_easy(messages_get("Username"));
+       lw->messages[AMI_LOGIN_MSG_PASS] = 
ami_utf8_easy(messages_get("Password"));
+       lw->messages[AMI_LOGIN_MSG_LOGIN] = 
ami_utf8_easy(messages_get("Login"));
+       lw->messages[AMI_LOGIN_MSG_CANCEL] = 
ami_utf8_easy(messages_get("Cancel"));
+
        len = strlen(username);
        assert(len < sizeof(lw->uname));
        memcpy(lw->uname, username, len + 1);
@@ -115,12 +135,11 @@ nserror gui_401login_open(nsurl *url, const char *realm,
                WINDOW_Position, WPOS_CENTERSCREEN,
                WINDOW_ParentGroup, lw->objects[GID_MAIN] = LayoutVObj,
                                LAYOUT_AddChild, StringObj,
-                                       STRINGA_TextVal,
-                                       lwc_string_data(lw->host),
+                                       STRINGA_TextVal, 
lwc_string_data(lw->host),
                                        GA_ReadOnly,TRUE,
                                StringEnd,
                                CHILD_Label, LabelObj,
-                                       LABEL_Text,messages_get("Host"),
+                                       LABEL_Text, 
lw->messages[AMI_LOGIN_MSG_HOST],
                                LabelEnd,
                                CHILD_WeightedHeight,0,
                                LAYOUT_AddChild, StringObj,
@@ -128,7 +147,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
                                        GA_ReadOnly,TRUE,
                                StringEnd,
                                CHILD_Label, LabelObj,
-                                       LABEL_Text,messages_get("Realm"),
+                                       LABEL_Text, 
lw->messages[AMI_LOGIN_MSG_REALM],
                                LabelEnd,
                                CHILD_WeightedHeight,0,
                                LAYOUT_AddChild, lw->objects[GID_USER] = 
StringObj,
@@ -137,7 +156,7 @@ nserror gui_401login_open(nsurl *url, const char *realm,
                                        STRINGA_TextVal, lw->uname,
                                StringEnd,
                                CHILD_Label, LabelObj,
-                                       LABEL_Text,messages_get("Username"),
+                                       LABEL_Text, 
lw->messages[AMI_LOGIN_MSG_USER],
                                LabelEnd,
                                CHILD_WeightedHeight,0,
                                LAYOUT_AddChild, lw->objects[GID_PASS] = 
StringObj,
@@ -147,21 +166,21 @@ nserror gui_401login_open(nsurl *url, const char *realm,
                                        STRINGA_TextVal, lw->pwd,
                                StringEnd,
                                CHILD_Label, LabelObj,
-                                       LABEL_Text,messages_get("Password"),
+                                       LABEL_Text, 
lw->messages[AMI_LOGIN_MSG_PASS],
                                LabelEnd,
                                CHILD_WeightedHeight,0,
                                LAYOUT_AddChild, LayoutHObj,
                                        LAYOUT_AddChild, lw->objects[GID_LOGIN] 
= ButtonObj,
                                                GA_ID,GID_LOGIN,
                                                GA_RelVerify,TRUE,
-                                               GA_Text,messages_get("Login"),
+                                               GA_Text, 
lw->messages[AMI_LOGIN_MSG_LOGIN],
                                                GA_TabCycle,TRUE,
                                        ButtonEnd,
                                        CHILD_WeightedHeight,0,
                                        LAYOUT_AddChild, 
lw->objects[GID_CANCEL] = ButtonObj,
                                                GA_ID,GID_CANCEL,
                                                GA_RelVerify,TRUE,
-                                               GA_Text,messages_get("Cancel"),
+                                               GA_Text, 
lw->messages[AMI_LOGIN_MSG_CANCEL],
                                                GA_TabCycle,TRUE,
                                        ButtonEnd,
                                LayoutEnd,
@@ -175,8 +194,10 @@ nserror gui_401login_open(nsurl *url, const char *realm,
        return NSERROR_OK;
 }
 
-static void ami_401login_close(struct gui_login_window *lw)
+static void ami_401login_close(void *w)
 {
+       struct gui_login_window *lw = (struct gui_login_window *)w;
+
        /* If continuation exists, then forbid refetch */
        if (lw->cb != NULL)
                lw->cb(NULL, NULL, lw->cbpw);
@@ -185,18 +206,31 @@ static void ami_401login_close(struct gui_login_window 
*lw)
        lwc_string_unref(lw->host);
        nsurl_unref(lw->url);
        free(lw->realm);
+
+       /* Free local charset version of messages */
+       for(int i = 0; i < AMI_LOGIN_MSG_MAX; i++) {
+               ami_utf8_free(lw->messages[i]);
+       }
+
        ami_gui_win_list_remove(lw);
 }
 
 static void ami_401login_login(struct gui_login_window *lw)
 {
-       ULONG *user,*pass;
+       char *user;
+       char *pass;
 
        GetAttr(STRINGA_TextVal,lw->objects[GID_USER],(ULONG *)&user);
        GetAttr(STRINGA_TextVal,lw->objects[GID_PASS],(ULONG *)&pass);
 
-       /* TODO: Encoding conversion to UTF8 for `user` and `pass`? */
-       lw->cb(user, pass, lw->cbpw);
+       char *user_utf8 = ami_to_utf8_easy(user);
+       char *pass_utf8 = ami_to_utf8_easy(pass);
+
+       if(user_utf8 && pass_utf8) {
+               lw->cb(user_utf8, pass_utf8, lw->cbpw);
+       } else {
+               amiga_warn_user("NoMemory", "");
+       }
 
        /* Invalidate continuation */
        lw->cb = NULL;


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to