comparison src/connection.c @ 6109:0922bb7a7bbc

[gaim-migrate @ 6571] Make attempting to sign on to an account twice not crash Gaim, and make the prompt for password request window only open once at max. I might change this in a few minutes, but this works, and I wanted to commit it before I break something. Move the gaim_request_input() call for "Please enter your password" to connection.c instead of gtkconn.c. There is no need for this to be in gtkconn.c, and doing it in core means less work for UIs. Make closing a notify window call the cancel action. Set the titles for request windows, when given. Remove a bit of odd, un-needed code from main.c (hitting "enter" in the password field was calling doenter which called dologin. Now it just calls dologin). committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 13 Jul 2003 18:33:25 +0000
parents 99f4bbeb27bc
children d1d8e70cf33d
comparison
equal deleted inserted replaced
6108:edbd278822a0 6109:0922bb7a7bbc
83 g_free(gc->away_state); 83 g_free(gc->away_state);
84 84
85 g_free(gc); 85 g_free(gc);
86 } 86 }
87 87
88 static void request_pass_ok_cb(GaimConnection *gc, const char *entry)
89 {
90 GaimAccount *account = gaim_connection_get_account(gc);
91
92 gaim_account_set_password(account, (*entry != '\0') ? entry : NULL);
93
94 gaim_connection_connect(gc);
95 }
96
97 static void request_pass_cancel_cb(GaimConnection *gc, const char *entry)
98 {
99 gaim_connection_destroy(gc);
100 }
101
102
88 void 103 void
89 gaim_connection_connect(GaimConnection *gc) 104 gaim_connection_connect(GaimConnection *gc)
90 { 105 {
91 GaimAccount *account; 106 GaimAccount *account;
92 GaimConnectionUiOps *ops; 107 GaimConnectionUiOps *ops;
101 116
102 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 117 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
103 118
104 account = gaim_connection_get_account(gc); 119 account = gaim_connection_get_account(gc);
105 120
121 if (gaim_connection_get_state(gc) != GAIM_DISCONNECTED)
122 return;
123
106 if (!(prpl_info->options & OPT_PROTO_NO_PASSWORD) && 124 if (!(prpl_info->options & OPT_PROTO_NO_PASSWORD) &&
107 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL) && 125 !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL) &&
108 gaim_account_get_password(account) == NULL) { 126 gaim_account_get_password(account) == NULL) {
109 127
110 gaim_debug(GAIM_DEBUG_INFO, "connection", "Requesting password\n"); 128 gaim_debug(GAIM_DEBUG_INFO, "connection", "Requesting password\n");
111 129
112 if (ops != NULL && ops->request_pass != NULL) 130 gaim_request_input(gc, NULL, _("Please enter your password"), NULL,
113 ops->request_pass(gc); 131 NULL, FALSE, TRUE,
132 _("OK"), G_CALLBACK(request_pass_ok_cb),
133 _("Cancel"), G_CALLBACK(request_pass_cancel_cb), gc);
114 134
115 return; 135 return;
116 } 136 }
117 137
118 gaim_connection_set_state(gc, GAIM_CONNECTING); 138 gaim_connection_set_state(gc, GAIM_CONNECTING);