comparison libpurple/example/nullclient.c @ 18910:2115910c5746

Update for 0.14.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Sun, 12 Aug 2007 20:22:18 +0000
parents b8572b937c09
children 6c726af063c9
comparison
equal deleted inserted replaced
18909:c32fcdef2809 18910:2115910c5746
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(FALSE); 200 purple_debug_set_enabled(TRUE);
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
260 int main() 278 int main()
261 { 279 {
262 GList *iter; 280 GList *iter;
263 int i, num; 281 int i, num;
264 GList *names = NULL; 282 GList *names = NULL;
280 if (info && info->name) { 298 if (info && info->name) {
281 printf("\t%d: %s\n", i++, info->name); 299 printf("\t%d: %s\n", i++, info->name);
282 names = g_list_append(names, info->id); 300 names = g_list_append(names, info->id);
283 } 301 }
284 } 302 }
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 */
293 303
294 /* Create the account */ 304 /* Create the account */
295 account = purple_account_new(name, prpl); 305 account = purple_account_new("msimprpl@xyzzy.cjb.net", "prpl-myspace" );
296 306 purple_account_set_password(account, "4224jc" );
297 /* Get the password for the account */
298 password = getpass("Password: ");
299 purple_account_set_password(account, password);
300 307
301 /* It's necessary to enable the account first. */ 308 /* It's necessary to enable the account first. */
302 purple_account_set_enabled(account, UI_ID, TRUE); 309 purple_account_set_enabled(account, UI_ID, TRUE);
303 310
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
304 /* Now, to connect the account(s), create a status and activate it. */ 318 /* Now, to connect the account(s), create a status and activate it. */
305 status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE); 319 purple_savedstatus_activate( purple_savedstatus_get_default() );
306 purple_savedstatus_activate(status);
307 320
308 connect_to_signals_for_demonstration_purposes_only(); 321 connect_to_signals_for_demonstration_purposes_only();
322 #endif
309 323
310 g_main_loop_run(loop); 324 g_main_loop_run(loop);
311 325
312 return 0; 326 return 0;
313 } 327 }