Exemplo n.º 1
0
static void prplcb_conn_notice( PurpleConnection *gc, const char *text )
{
	struct im_connection *ic = purple_ic_by_gc( gc );
	
	if( ic != NULL )
		imcb_log( ic, "%s", text );
}
Exemplo n.º 2
0
static void prplcb_conn_disconnected(PurpleConnection *gc)
{
	struct im_connection *ic = purple_ic_by_gc(gc);

	if (ic != NULL) {
		imc_logout(ic, !gc->wants_to_die);
	}
}
Exemplo n.º 3
0
static void prplcb_conn_report_disconnect_reason( PurpleConnection *gc, PurpleConnectionError reason, const char *text )
{
	struct im_connection *ic = purple_ic_by_gc( gc );
	
	/* PURPLE_CONNECTION_ERROR_NAME_IN_USE means concurrent login,
	   should probably handle that. */
	if( ic != NULL )
		imcb_error( ic, "%s", text );
}
Exemplo n.º 4
0
static void *prplcb_notify_email( PurpleConnection *gc, const char *subject, const char *from,
                                  const char *to, const char *url )
{
	struct im_connection *ic = purple_ic_by_gc( gc );
	
	imcb_log( ic, "Received e-mail from %s for %s: %s <%s>", from, to, subject, url );
	
	return NULL;
}
Exemplo n.º 5
0
static void *prplcb_notify_userinfo( PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info )
{
	struct im_connection *ic = purple_ic_by_gc( gc );
	GString *info = g_string_new( "" );
	GList *l = purple_notify_user_info_get_entries( user_info );
	char *key;
	const char *value;
	int n;
	
	while( l )
	{
		PurpleNotifyUserInfoEntry *e = l->data;
		
		switch( purple_notify_user_info_entry_get_type( e ) )
		{
		case PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR:
		case PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER:
			key = g_strdup( purple_notify_user_info_entry_get_label( e ) );
			value = purple_notify_user_info_entry_get_value( e );
			
			if( key )
			{
				strip_html( key );
				g_string_append_printf( info, "%s: ", key );
				
				if( value )
				{
					n = strlen( value ) - 1;
					while( isspace( value[n] ) )
						n --;
					g_string_append_len( info, value, n + 1 );
				}
				g_string_append_c( info, '\n' );
				g_free( key );
			}
			
			break;
		case PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK:
			g_string_append( info, "------------------------\n" );
			break;
		}
		
		l = l->next;
	}
	
	imcb_log( ic, "User %s info:\n%s", who, info->str );
	g_string_free( info, TRUE );
	
	return NULL;
}
Exemplo n.º 6
0
static void prplcb_conn_connected(PurpleConnection *gc)
{
	struct im_connection *ic = purple_ic_by_gc(gc);
	const char *dn;
	set_t *s;

	imcb_connected(ic);

	if ((dn = purple_connection_get_display_name(gc)) &&
	    (s = set_find(&ic->acc->set, "display_name"))) {
		g_free(s->value);
		s->value = g_strdup(dn);
	}

	// user list needs to be requested for Gadu-Gadu
	purple_gg_buddylist_import(gc);

	ic->flags |= OPT_DOES_HTML;
}
Exemplo n.º 7
0
static void purple_gg_buddylist_import(PurpleConnection *gc)
{
	struct im_connection *ic = purple_ic_by_gc(gc);

	if (set_getstr(&ic->acc->set, "gg_sync_contacts")) {
		GList *actions = gc->prpl->info->actions(gc->prpl, gc);
		GList *p;
		for (p = g_list_first(actions); p; p = p->next) {
			if (((PurplePluginAction *) p->data) &&
			    purple_menu_cmp(((PurplePluginAction *) p->data)->label,
			                    "Download buddylist from Server") == 0) {
				PurplePluginAction action;
				action.plugin = gc->prpl;
				action.context = gc;
				action.user_data = NULL;
				((PurplePluginAction *) p->data)->callback(&action);
				break;
			}
		}
		g_list_free(actions);
	}
}
Exemplo n.º 8
0
static void prplcb_conn_progress( PurpleConnection *gc, const char *text, size_t step, size_t step_count )
{
	struct im_connection *ic = purple_ic_by_gc( gc );
	
	imcb_log( ic, "%s", text );
}