Mercurial > pidgin.yaz
comparison libpurple/example/nullclient.c @ 19547:6c726af063c9
Revert jeff2's changes from 2007-08-12. Specifically revision
a86eabd31cf08d9b410391ddba7a201bbeb35f9c. The changes were made to
the im.pidgin.soc.2007.msimprpl. I'm guessing he checked these
in accidentally. It caused a bunch of compile warnings.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 30 Aug 2007 06:45:27 +0000 |
parents | 2115910c5746 |
children | 57d350900136 |
comparison
equal
deleted
inserted
replaced
19546:1a8d6ab0c662 | 19547:6c726af063c9 |
---|---|
195 { | 195 { |
196 /* Set a custom user directory (optional) */ | 196 /* Set a custom user directory (optional) */ |
197 purple_util_set_user_dir(CUSTOM_USER_DIRECTORY); | 197 purple_util_set_user_dir(CUSTOM_USER_DIRECTORY); |
198 | 198 |
199 /* We do not want any debugging for now to keep the noise to a minimum. */ | 199 /* We do not want any debugging for now to keep the noise to a minimum. */ |
200 purple_debug_set_enabled(TRUE); | 200 purple_debug_set_enabled(FALSE); |
201 | 201 |
202 /* Set the core-uiops, which is used to | 202 /* Set the core-uiops, which is used to |
203 * - initialize the ui specific preferences. | 203 * - initialize the ui specific preferences. |
204 * - initialize the debug ui. | 204 * - initialize the debug ui. |
205 * - initialize the ui components for all the modules. | 205 * - initialize the ui components for all the modules. |
255 static int handle; | 255 static int handle; |
256 purple_signal_connect(purple_connections_get_handle(), "signed-on", &handle, | 256 purple_signal_connect(purple_connections_get_handle(), "signed-on", &handle, |
257 PURPLE_CALLBACK(signed_on), NULL); | 257 PURPLE_CALLBACK(signed_on), NULL); |
258 } | 258 } |
259 | 259 |
260 | |
261 | |
262 | |
263 void signedOn( PurpleConnection *gc, gpointer dummy ) { | |
264 | |
265 | |
266 if( gc ) { | |
267 | |
268 PurpleAccount* a = purple_connection_get_account( gc ); | |
269 | |
270 if( a ) { | |
271 | |
272 purple_presence_set_idle( purple_account_get_presence( a ), TRUE, time( NULL ) ); | |
273 } | |
274 } | |
275 } | |
276 | |
277 | |
278 int main() | 260 int main() |
279 { | 261 { |
280 GList *iter; | 262 GList *iter; |
281 int i, num; | 263 int i, num; |
282 GList *names = NULL; | 264 GList *names = NULL; |
298 if (info && info->name) { | 280 if (info && info->name) { |
299 printf("\t%d: %s\n", i++, info->name); | 281 printf("\t%d: %s\n", i++, info->name); |
300 names = g_list_append(names, info->id); | 282 names = g_list_append(names, info->id); |
301 } | 283 } |
302 } | 284 } |
285 printf("Select the protocol [0-%d]: ", i-1); | |
286 fgets(name, sizeof(name), stdin); | |
287 sscanf(name, "%d", &num); | |
288 prpl = g_list_nth_data(names, num); | |
289 | |
290 printf("Username: "); | |
291 fgets(name, sizeof(name), stdin); | |
292 name[strlen(name) - 1] = 0; /* strip the \n at the end */ | |
303 | 293 |
304 /* Create the account */ | 294 /* Create the account */ |
305 account = purple_account_new("msimprpl@xyzzy.cjb.net", "prpl-myspace" ); | 295 account = purple_account_new(name, prpl); |
306 purple_account_set_password(account, "4224jc" ); | 296 |
297 /* Get the password for the account */ | |
298 password = getpass("Password: "); | |
299 purple_account_set_password(account, password); | |
307 | 300 |
308 /* It's necessary to enable the account first. */ | 301 /* It's necessary to enable the account first. */ |
309 purple_account_set_enabled(account, UI_ID, TRUE); | 302 purple_account_set_enabled(account, UI_ID, TRUE); |
310 | 303 |
311 #if 0 | |
312 static int handle; | |
313 purple_signal_connect( purple_connections_get_handle(), | |
314 "signed-on", &handle, | |
315 PURPLE_CALLBACK( signedOn ), | |
316 NULL ); | |
317 | |
318 /* Now, to connect the account(s), create a status and activate it. */ | 304 /* Now, to connect the account(s), create a status and activate it. */ |
319 purple_savedstatus_activate( purple_savedstatus_get_default() ); | 305 status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE); |
306 purple_savedstatus_activate(status); | |
320 | 307 |
321 connect_to_signals_for_demonstration_purposes_only(); | 308 connect_to_signals_for_demonstration_purposes_only(); |
322 #endif | |
323 | 309 |
324 g_main_loop_run(loop); | 310 g_main_loop_run(loop); |
325 | 311 |
326 return 0; | 312 return 0; |
327 } | 313 } |