Ejemplo n.º 1
0
static void edit_jpilot_fill_check_box( JPilotFile *jpf ) {
	gint i;
	GList *node, *customLbl = NULL;
	gchar *labelName;
	gboolean done, checked;
	for( i = 0; i < JPILOT_NUM_CUSTOM_LABEL; i++ ) {
		gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( jpilotedit.custom_check[i] ), FALSE );
		gtk_label_set_text( GTK_LABEL( jpilotedit.custom_label[i] ), "" );
	}

	done = FALSE;
	i = 0;
	customLbl = jpilot_load_custom_label( jpf, customLbl );
	node = customLbl;
	while( ! done ) {
		if( node ) {
			labelName = node->data;
			gtk_label_set_text( GTK_LABEL( jpilotedit.custom_label[i] ), labelName );
			checked = jpilot_test_custom_label( jpf, labelName );
			gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( jpilotedit.custom_check[i] ), checked );
			i++;
			if( i >= JPILOT_NUM_CUSTOM_LABEL ) done = TRUE;
			node = g_list_next( node );
		}
		else {
			done = TRUE;
		}
	}
	mgu_free_dlist( customLbl );
	customLbl = NULL;
}
Ejemplo n.º 2
0
/**
 * Process a single label entry field, parsing multiple e-mail address entries.
 *
 * \param pilotFile  JPilot control data.
 * \param labelEntry Label entry data.
 * \param person     Person.
 */
static void jpilot_parse_label( JPilotFile *pilotFile, gchar *labelEntry, ItemPerson *person ) {
	gchar buffer[ EMAIL_BUFSIZE ];
	ItemEMail *email;
	GList *list, *node;

	if( labelEntry ) {
		*buffer = '\0';
		strcpy( buffer, labelEntry );
		node = list = jpilot_parse_email( buffer );
		while( node ) {
			gchar convertBuff[JPILOT_LEN_LABEL];
			email = addritem_create_item_email();
			addritem_email_set_address( email, node->data );
			if (convert_charcode) {
				conv_sjistoeuc(convertBuff, JPILOT_LEN_LABEL, buffer);
				addritem_email_set_remarks(email, convertBuff);
			}
			else {
				addritem_email_set_remarks(email, buffer);
			}

			addrcache_id_email( pilotFile->addressCache, email );
			addrcache_person_add_email( pilotFile->addressCache, person, email );
			node = g_list_next( node );
		}
		mgu_free_dlist( list );
		list = NULL;
	}
}
Ejemplo n.º 3
0
static void edit_ldap_bdn_load_data(
	const gchar *hostName, const gint iPort, const gint tov,
	const gchar* bindDN, const gchar *bindPW, int ssl, int tls )
{
	gchar *sHost;
	gchar *sMsg = NULL;
	gchar sPort[20];
	gboolean flgConn;
	gboolean flgDN;
	GList *baseDN = NULL;

	edit_ldap_bdn_status_show( "" );
	gtk_cmclist_clear(GTK_CMCLIST(ldapedit_basedn.basedn_list));
	ldapedit_basedn_bad_server = TRUE;
	flgConn = flgDN = FALSE;
	sHost = g_strdup( hostName );
	sprintf( sPort, "%d", iPort );
	gtk_label_set_text(GTK_LABEL(ldapedit_basedn.host_label), hostName);
	gtk_label_set_text(GTK_LABEL(ldapedit_basedn.port_label), sPort);
	if( *sHost != '\0' ) {
		/* Test connection to server */
		if( ldaputil_test_connect( sHost, iPort, ssl, tls, tov ) ) {
			/* Attempt to read base DN */
			baseDN = ldaputil_read_basedn( sHost, iPort, bindDN, bindPW, tov, ssl, tls );
			if( baseDN ) {
				GList *node = baseDN;
				gchar *text[2] = { NULL, NULL };

				while( node ) {
					text[0] = (gchar *)node->data;
					gtk_cmclist_append(GTK_CMCLIST(ldapedit_basedn.basedn_list), text);
					node = g_list_next( node );
					flgDN = TRUE;
				}
				mgu_free_dlist( baseDN );
				baseDN = node = NULL;
			}
			ldapedit_basedn_bad_server = FALSE;
			flgConn = TRUE;
		}
	}
	g_free( sHost );

	/* Display appropriate message */
	if( flgConn ) {
		if( ! flgDN ) {
			sMsg = _( "Could not read Search Base(s) from server - please set manually" );
		}
	}
	else {
		sMsg = _( "Could not connect to server" );
	}
	edit_ldap_bdn_status_show( sMsg );
}
Ejemplo n.º 4
0
/*
 * Parse address line adn build address items.
 * Enter: muttFile MUTT control data.
 *        cache    Address cache.
 *        line     Data record.
 */
static void mutt_build_items( MuttFile *muttFile, AddressCache *cache, gchar *line ) {
	GList *list, *node;
	gint tCount, aCount;
	gchar *aliasTag, *aliasName, *recipient;
	GSList *addrList;

	/* printf( "\nBUILD >%s<\n", line ); */
	list = mgu_parse_string( line,  3, &tCount );
	if( tCount < 3 ) {
		if( list ) {
			mgu_free_dlist( list );
			list = NULL;
		}
		return;
	}

	aliasTag = list->data;
	node = g_list_next( list );
	aliasName = node->data;
	node = g_list_next( node );
	recipient = node->data;

	addrList = NULL;
	if( strcmp( aliasTag, MUTT_TAG_ALIAS ) == 0 ) {
		aCount = 0;
		/* printf( "aliasName :%s:\n", aliasName ); */
		/* printf( "recipient :%s:\n", recipient ); */
		addrList = mutt_parse_rcplist( recipient, &aCount );
		/* printf( "---\n" ); */
		mutt_build_address( muttFile, cache, aliasName, addrList, aCount );
	}

	mgu_free_dlist( list );
	list = NULL;

}
Ejemplo n.º 5
0
/*
 * ============================================================================
 * Read all files in specified directory into address book.
 * Enter:  harvester Harvester object.
 *         cache     Address cache to load.
 *         msgList   List of message numbers, or NULL to process folder.
 * Return: Status.
 * ============================================================================
 */
gint addrharvest_harvest(
	AddressHarvester *harvester, AddressCache *cache, GList *msgList )
{
	gint retVal;
	GList *node;
	GList *listHdr;

	retVal = MGU_BAD_ARGS;
	g_return_val_if_fail( harvester != NULL, retVal );
	g_return_val_if_fail( cache != NULL, retVal );
	g_return_val_if_fail( harvester->path != NULL, retVal );

	/* Clear cache */
	addrcache_clear( cache );
	cache->dataRead = FALSE;

	/* Build list of headers of interest */
	listHdr = NULL;
	node = harvester->headerTable;
	while( node ) {
		HeaderEntry *entry;

		entry = node->data;
		if( entry->selected ) {
			gchar *p;

			p = g_strdup( entry->header );
			g_strdown( p );
			listHdr = g_list_append( listHdr, p );
		}
		node = g_list_next( node );
	}

	/* Process directory/files */
	if( msgList == NULL ) {
		addrharvest_harvest_dir( harvester, cache, listHdr, harvester->path );
	}
	else {
		addrharvest_harvest_list( harvester, cache, listHdr, msgList );
	}
	mgu_free_dlist( listHdr );

	/* Mark cache */
	cache->modified = FALSE;
	cache->dataRead = TRUE;

	return retVal;
}
Ejemplo n.º 6
0
/*
* Free up custom label list.
*/
void jpilot_clear_custom_labels( JPilotFile *pilotFile ) {
	GList *node;

	g_return_if_fail( pilotFile != NULL );

	/* Release custom labels */
	mgu_free_dlist( pilotFile->customLabels );
	pilotFile->customLabels = NULL;

	/* Release indexes */
	node = pilotFile->labelInd;
	while( node ) {
		node->data = NULL;
		node = g_list_next( node );
	}
	g_list_free( pilotFile->labelInd );
	pilotFile->labelInd = NULL;

	/* Force a fresh read */
	addrcache_refresh( pilotFile->addressCache );
}
Ejemplo n.º 7
0
/**
 * Clear list of LDAP search attributes.
 * \param  ctl  Control data object.
 */
void ldapctl_criteria_list_clear( LdapControl *ctl ) {
	cm_return_if_fail( ctl != NULL );
	mgu_free_dlist( ctl->listCriteria );
	ctl->listCriteria = NULL;
}