Exemplo n.º 1
0
void	stock_data(char *buff)
{
	int		i, j, k;
	i = 0;
	j = 0;
	k = 0;
	while (*(buff + i) != 0)
	{
		if (buff[i] == ';')
		{
			check_get(j);
			j++;
			k = 0;
		}
		else
		{
			if (j == 0)
				get_firstname(buff, k, i);
			if (j == 1)
				get_lastname(buff, k, i);
			if (j == 2)
				get_email(buff, k, i);
			if (j == 3)
				get_grade(buff, k, i);
			if (j == 4)
				get_city(buff, k, i);
			k++;
		}
		i++;
	}
	check_get(4);
}
Exemplo n.º 2
0
int main(int argc, const char *argv[])
{

    FILE *file = fopen("1.html", "r");
    if (!file) {
        fclose(file);
        printf("fail to open!\n");
    } else
        //       while(!feof(file)){
        //         fgets(str,sizeof(str),file);
        while (fgets(str, sizeof(str), file) != NULL) {


            get_email(str);
        }

}
Exemplo n.º 3
0
static void
eab_composer_created_cb (GObject *source_object,
			 GAsyncResult *result,
			 gpointer user_data)
{
	CreateComposerData *ccd = user_data;
	EComposerHeaderTable *table;
	EMsgComposer *composer;
	GError *error = NULL;

	g_return_if_fail (ccd != NULL);

	composer = e_msg_composer_new_finish (result, &error);
	if (error) {
		g_warning ("%s: Failed to create msg composer: %s", G_STRFUNC, error->message);
		g_clear_error (&error);
	} else {
		table = e_msg_composer_get_header_table (composer);

		if (ccd->to_destinations)
			e_composer_header_table_set_destinations_to (table, ccd->to_destinations);

		if (ccd->bcc_destinations)
			e_composer_header_table_set_destinations_bcc (table, ccd->bcc_destinations);

		if (ccd->attachment_destinations) {
			CamelMimePart *attachment;
			GSList *contacts, *iter;
			gchar *data;

			attachment = camel_mime_part_new ();

			contacts = g_slist_copy (ccd->attachment_destinations);
			for (iter = contacts; iter != NULL; iter = iter->next)
				iter->data = e_destination_get_contact (iter->data);
			data = eab_contact_list_to_string (contacts);
			g_slist_free (contacts);

			camel_mime_part_set_content (attachment, data, strlen (data), "text/x-vcard");

			if (ccd->attachment_destinations->next != NULL) {
				camel_mime_part_set_description (attachment, _("Multiple vCards"));
			} else {
				EContact *contact;
				const gchar *file_as;
				gchar *description;

				contact = e_destination_get_contact (ccd->attachment_destinations->data);
				file_as = e_contact_get_const (contact, E_CONTACT_FILE_AS);
				description = g_strdup_printf (_("vCard for %s"), file_as);
				camel_mime_part_set_description (attachment, description);
				g_free (description);
			}

			camel_mime_part_set_disposition (attachment, "attachment");

			e_msg_composer_attach (composer, attachment);
			g_object_unref (attachment);

			if (ccd->attachment_destinations->next != NULL) {
				e_composer_header_table_set_subject (table, _("Contact information"));
			} else {
				EContact *contact;
				gchar *tempstr;
				const gchar *tempstr2;
				gchar *tempfree = NULL;

				contact = e_destination_get_contact (ccd->attachment_destinations->data);
				tempstr2 = e_contact_get_const (contact, E_CONTACT_FILE_AS);
				if (!tempstr2 || !*tempstr2)
					tempstr2 = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
				if (!tempstr2 || !*tempstr2)
					tempstr2 = e_contact_get_const (contact, E_CONTACT_ORG);
				if (!tempstr2 || !*tempstr2) {
					g_free (tempfree);
					tempstr2 = get_email (contact, E_CONTACT_EMAIL_1, &tempfree);
				}
				if (!tempstr2 || !*tempstr2) {
					g_free (tempfree);
					tempstr2 = get_email (contact, E_CONTACT_EMAIL_2, &tempfree);
				}
				if (!tempstr2 || !*tempstr2) {
					g_free (tempfree);
					tempstr2 = get_email (contact, E_CONTACT_EMAIL_3, &tempfree);
				}

				if (!tempstr2 || !*tempstr2)
					tempstr = g_strdup_printf (_("Contact information"));
				else
					tempstr = g_strdup_printf (_("Contact information for %s"), tempstr2);

				e_composer_header_table_set_subject (table, tempstr);

				g_free (tempstr);
				g_free (tempfree);
			}
		}

		gtk_widget_show (GTK_WIDGET (composer));
	}

	if (ccd->to_destinations)
		e_destination_freev (ccd->to_destinations);
	if (ccd->bcc_destinations)
		e_destination_freev (ccd->bcc_destinations);
	g_slist_free_full (ccd->attachment_destinations, g_object_unref);

	g_free (ccd);
}
Exemplo n.º 4
0
int
main (void)			/* wnlee */
{
	FILE *fp, *fpw, *fpr;
	char f_path[] = "/log/identlog", anony_log[] = "/log/anonymous_log",
	  real_del[] = "/log/real_del_log";
	char email[512], id[512], buf[512];

	init_bbsenv ();

	fp = fopen (f_path, "r");
	if (fp == NULL)
	{
		fprintf (stderr, "cannot open identlog\n");
		return -1;
	}
	fpw = fopen (anony_log, "w");
	if (fpw == NULL)
	{
		perror ("cannot write log\n");
		exit (0);
	}
	fprintf (fpw, "BBS ID		用來認證的 email\n====================================\n");

	fpr = fopen (real_del, "w");
	fprintf (fpr, "以下是真正取消其認證資格的帳號清單\n");

	while (fgets (buf, sizeof (buf), fp))
	{

		if (!strncmp (buf, "From ", 5))
		{
#ifdef debug
			printf ("buf: [%s]\n", buf);
#endif
			get_email (email, sizeof (email), buf);
#ifdef debug
			printf ("email [%s]\n", email);
			printf ("check result [%d]\n", check (email));
#endif
			if (check (email))
			{
				do
				{
					fgets (buf, sizeof (buf), fp);
				}
				while (strncmp (buf, "Subject: ", 9));

				get_id (id, sizeof (id), buf);
#ifdef debug
				printf ("id [%s]\n", id);
#endif
				cancel_ident (id, email, fpr);
				writelog ((char *) id, (char *) email, fpw);
			}
		}
	}
	fclose (fp);
	fclose (fpw);
	fclose (fpr);
	printf ("created following files\n[%s%s]\n", HOMEBBS, anony_log);
	printf ("[%s%s] \n", HOMEBBS, real_del);
	return 0;
}
Exemplo n.º 5
0
void
eab_send_as_attachment (EShell *shell,
                        GSList *destinations)
{
	EMsgComposer *composer;
	EComposerHeaderTable *table;
	CamelMimePart *attachment;
	GSList *contacts, *iter;
	gchar *data;

	g_return_if_fail (E_IS_SHELL (shell));

	if (destinations == NULL)
		return;

	composer = e_msg_composer_new (shell);
	table = e_msg_composer_get_header_table (composer);

	attachment = camel_mime_part_new ();

	contacts = g_slist_copy (destinations);
	for (iter = contacts; iter != NULL; iter = iter->next)
		iter->data = e_destination_get_contact (iter->data);
	data = eab_contact_list_to_string (contacts);
	g_slist_free (contacts);

	camel_mime_part_set_content (
		attachment, data, strlen (data), "text/x-vcard");

	if (destinations->next != NULL)
		camel_mime_part_set_description (
			attachment, _("Multiple vCards"));
	else {
		EContact *contact;
		const gchar *file_as;
		gchar *description;

		contact = e_destination_get_contact (destinations->data);
		file_as = e_contact_get_const (contact, E_CONTACT_FILE_AS);
		description = g_strdup_printf (_("vCard for %s"), file_as);
		camel_mime_part_set_description (attachment, description);
		g_free (description);
	}

	camel_mime_part_set_disposition (attachment, "attachment");

	e_msg_composer_attach (composer, attachment);
	g_object_unref (attachment);

	if (destinations->next != NULL)
		e_composer_header_table_set_subject (
			table, _("Contact information"));
	else {
		EContact *contact;
		gchar *tempstr;
		const gchar *tempstr2;
		gchar *tempfree = NULL;

		contact = e_destination_get_contact (destinations->data);
		tempstr2 = e_contact_get_const (contact, E_CONTACT_FILE_AS);
		if (!tempstr2 || !*tempstr2)
			tempstr2 = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
		if (!tempstr2 || !*tempstr2)
			tempstr2 = e_contact_get_const (contact, E_CONTACT_ORG);
		if (!tempstr2 || !*tempstr2) {
			g_free (tempfree);
			tempstr2 = get_email (contact, E_CONTACT_EMAIL_1, &tempfree);
		}
		if (!tempstr2 || !*tempstr2) {
			g_free (tempfree);
			tempstr2 = get_email (contact, E_CONTACT_EMAIL_2, &tempfree);
		}
		if (!tempstr2 || !*tempstr2) {
			g_free (tempfree);
			tempstr2 = get_email (contact, E_CONTACT_EMAIL_3, &tempfree);
		}

		if (!tempstr2 || !*tempstr2)
			tempstr = g_strdup_printf (_("Contact information"));
		else
			tempstr = g_strdup_printf (_("Contact information for %s"), tempstr2);

		e_composer_header_table_set_subject (table, tempstr);

		g_free (tempstr);
		g_free (tempfree);
	}

	gtk_widget_show (GTK_WIDGET (composer));
}