comparison src/proxy.c @ 13968:6fc412e59214

[gaim-migrate @ 16525] A bunch of little things * Use GAIM_CONNECTION_IS_VALID(gc) in a lot of places where we were doing g_list_find(gaim_connections_get_all(), gc) * Get rid of a lot of places where we were doing g_list_find(gaim_connections_get_all(), gc). The handle used by the request API ensures that the ok and cancel callback functions won't be called if the gc is destroyed. However, GAIM_CONNECTION_IS_VALID(gc) is still very important for callback functions where we can't cancel the request. For example, gaim_proxy_connect() callback functions. * "Added" a function to Yahoo! that should help us notice when our buddies change their buddy icon/display picture * Some comments in a few places * Changed GAIM_CONNECTION_IS_VALID(gc) to only look through the list of "all" connections and not the list of "connecting" connections. Some time ago we changed how this was done so that the list of "all" connections now includes the "connection" connections. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 20 Jul 2006 08:11:54 +0000
parents 59af3aecf580
children 8bda65b88e49
comparison
equal deleted inserted replaced
13967:99b9b58b19dd 13968:6fc412e59214
84 void 84 void
85 gaim_proxy_info_destroy(GaimProxyInfo *info) 85 gaim_proxy_info_destroy(GaimProxyInfo *info)
86 { 86 {
87 g_return_if_fail(info != NULL); 87 g_return_if_fail(info != NULL);
88 88
89 if (info->host != NULL) g_free(info->host); 89 g_free(info->host);
90 if (info->username != NULL) g_free(info->username); 90 g_free(info->username);
91 if (info->password != NULL) g_free(info->password); 91 g_free(info->password);
92 92
93 g_free(info); 93 g_free(info);
94 } 94 }
95 95
96 void 96 void
104 void 104 void
105 gaim_proxy_info_set_host(GaimProxyInfo *info, const char *host) 105 gaim_proxy_info_set_host(GaimProxyInfo *info, const char *host)
106 { 106 {
107 g_return_if_fail(info != NULL); 107 g_return_if_fail(info != NULL);
108 108
109 if (info->host != NULL) 109 g_free(info->host);
110 g_free(info->host);
111 110
112 info->host = (host == NULL ? NULL : g_strdup(host)); 111 info->host = (host == NULL ? NULL : g_strdup(host));
113 } 112 }
114 113
115 void 114 void
123 void 122 void
124 gaim_proxy_info_set_username(GaimProxyInfo *info, const char *username) 123 gaim_proxy_info_set_username(GaimProxyInfo *info, const char *username)
125 { 124 {
126 g_return_if_fail(info != NULL); 125 g_return_if_fail(info != NULL);
127 126
128 if (info->username != NULL) 127 g_free(info->username);
129 g_free(info->username);
130 128
131 info->username = (username == NULL ? NULL : g_strdup(username)); 129 info->username = (username == NULL ? NULL : g_strdup(username));
132 } 130 }
133 131
134 void 132 void
135 gaim_proxy_info_set_password(GaimProxyInfo *info, const char *password) 133 gaim_proxy_info_set_password(GaimProxyInfo *info, const char *password)
136 { 134 {
137 g_return_if_fail(info != NULL); 135 g_return_if_fail(info != NULL);
138 136
139 if (info->password != NULL) 137 g_free(info->password);
140 g_free(info->password);
141 138
142 info->password = (password == NULL ? NULL : g_strdup(password)); 139 info->password = (password == NULL ? NULL : g_strdup(password));
143 } 140 }
144 141
145 GaimProxyType 142 GaimProxyType
301 #ifdef HAVE_SIGNAL_H 298 #ifdef HAVE_SIGNAL_H
302 static void 299 static void
303 trap_gdb_bug() 300 trap_gdb_bug()
304 { 301 {
305 const char *message = 302 const char *message =
306 "Gaim's DNS child got a SIGTRAP signal. \n" 303 "Gaim's DNS child got a SIGTRAP signal.\n"
307 "This can be caused by trying to run gaim inside gdb.\n" 304 "This can be caused by trying to run gaim inside gdb.\n"
308 "There is a known gdb bug which prevents this. Supposedly gaim\n" 305 "There is a known gdb bug which prevents this. Supposedly gaim\n"
309 "should have detected you were using gdb and used an ugly hack,\n" 306 "should have detected you were using gdb and used an ugly hack,\n"
310 "check cope_with_gdb_brokenness() in proxy.c.\n\n" 307 "check cope_with_gdb_brokenness() in proxy.c.\n\n"
311 "For more info about this bug, see http://sources.redhat.com/ml/gdb/2001-07/msg00349.html\n"; 308 "For more info about this bug, see http://sources.redhat.com/ml/gdb/2001-07/msg00349.html\n";
2317 } 2314 }
2318 2315
2319 return gpi; 2316 return gpi;
2320 } 2317 }
2321 2318
2319 /*
2320 * TODO: It would be really good if this returned some sort of handle
2321 * that we could use to cancel the connection. As it is now,
2322 * each callback has to check to make sure gc is still valid.
2323 * And that is ugly.
2324 */
2322 int 2325 int
2323 gaim_proxy_connect(GaimAccount *account, const char *host, int port, 2326 gaim_proxy_connect(GaimAccount *account, const char *host, int port,
2324 GaimInputFunction func, gpointer data) 2327 GaimInputFunction func, gpointer data)
2325 { 2328 {
2326 const char *connecthost = host; 2329 const char *connecthost = host;