static void objects_added (EBookClientView *view, const GSList *contacts, gpointer user_data) { const GSList *l; GMainLoop *loop = (GMainLoop *) user_data; for (l = contacts; l; l = l->next) { EContact *contact = l->data; #if !COMPARE_PERFORMANCE print_contact (contact); #endif if (uids_only && e_contact_get_const (contact, E_CONTACT_FULL_NAME) != NULL) g_error ( "received contact name `%s' when only the uid was requested", (gchar *) e_contact_get_const (contact, E_CONTACT_FULL_NAME)); else if (!uids_only && e_contact_get_const (contact, E_CONTACT_FULL_NAME) == NULL) g_error ("expected contact name missing"); } if (!loading_view) finish_test (view, loop); }
void print_contact_list( const contact_list_t& contact_list ) { cout << "Contacts:" << endl; for ( contact_list_t::const_iterator it = contact_list.begin(); it != contact_list.end(); it++ ) { cout << it->first << ": "; print_contact( it->second ); } }
static void contacts_added (EBookView *book_view, const GList *contacts) { GList *l; for (l = (GList*)contacts; l; l = l->next) { print_contact (l->data); } }
static void objects_modified (EBookView *book_view, const GSList *contacts) { GSList *l; for (l = (GSList *) contacts; l; l = l->next) { print_contact (l->data); } }
static void objects_added (EBookClientView *view, const GSList *contacts) { const GSList *l; for (l = contacts; l; l = l->next) { EContact *contact = l->data; print_contact (contact); if (e_contact_get_const (contact, E_CONTACT_FULL_NAME) != NULL) g_error ("received contact name `%s' when only the uid and revision was requested", (gchar *) e_contact_get_const (contact, E_CONTACT_FULL_NAME)); } if (!loading_view) finish_test (view); }
void print_contact_list(struct ContactList *clPtr) { struct ContactList *liste; FILE *dosya = fopen("teldefteri.txt", "r"); if (fgetc(dosya) == '#') { print_contact(); } else { fclose(dosya); } while (!feof(dosya)) { fscanf(dosya, "%s%s%s", liste->kisi); printf("%s\t\t\t", liste->kisi); } }
int main(int argc, char *argv[]) { int ret = 1, istty, i, idx, delete_all = 0, updated = 0; dldev_t dev; contact_t db; contact_data_t rec; u8 *data; u16 len; /* for data security */ /* umask(S_IRWXG | S_IRWXO); */ istty = isatty(0); while((i = getopt(argc, argv, "hd:a")) != -1){ switch(i){ case 'd': dev_file = optarg; break; case 'a': delete_all = 1; break; case 'h': default: usage(); break; } } argc -= optind; argv += optind; #ifdef USB_USBHID dev.usb.file = dev_file; #endif memset(&rec, 0, sizeof(contact_data_t)); BEGIN_OPT() OPT("msg", rec.msg) OPT("type", rec.type) OPT("area", rec.area) OPT("number", rec.number) END_OPT() if(delete_all){ fprintf(stderr, "WARNING: DELETE ALL CONTACTS IN THE WATCH (Y/N)? "); if(tolower(getchar()) != 'y') exit(0); }else if(istty && (!rec.msg || !rec.type || !rec.area || !rec.number)) usage(); /* TODO: long phone number extending to the next or previous record */ if(open_dev(&dev)){ ERROR("open_dev"); goto exit; } if(start_session(&dev)){ ERROR("read_app_info"); goto exit; } /******************************************************************************/ #ifdef DEBUG for(i = 0; i < NUM_APPS; i++){ if(!dev.app[i].acd.app_idx) continue; printf("%2d: %d%d%d%d%d%d%d%d %02x %02x %04x %04x %04x %04x %04x %04x %s\n", i, dev.app[i].acd.app_idx, dev.app[i].acd.code_loc, dev.app[i].acd.db_loc, dev.app[i].acd.code_invalid, dev.app[i].acd.db_modified, dev.app[i].acd.db_invalid, dev.app[i].acd.passwd_req, dev.app[i].acd.mode_name, dev.app[i].acb.app_type, dev.app[i].acb.app_inst, dev.app[i].acb.asd_addr, dev.app[i].acb.add_addr, dev.app[i].acb.state_mgr_addr, dev.app[i].acb.refresh_addr, dev.app[i].acb.banner_addr, dev.app[i].acb.code_addr, dev.app[i].banner ); } #endif /******************************************************************************/ if((idx = find_app(&dev, "CONTACT")) < 0){ ERROR("CONTACT application not found"); goto end; } if(dump_add(&dev, idx, &data, &len)){ ERROR("dump_add"); goto end; } read_contact(&db, data); free(data); if(delete_all){ while(!del_contact(&db, 0)) updated = 1; }else{ if(!istty && !del_contact_file(&db, stdin)) updated = 1; if(rec.msg && rec.type && rec.area && rec.number && (i = find_contact(&db, &rec)) >= 0 && !del_contact(&db, i)) updated = 1; } if(updated){ create_contact(&db, &data, &len); if(load_add(&dev, idx, data)){ ERROR("load_add"); goto end; } free(data); } print_contact(&db, stdout); free_contact(&db); /******************************************************************************/ end: if(end_session(&dev)){ ERROR("end_session"); goto exit; } ret = 0; exit: close_dev(&dev); exit(ret); }
int main(int argc, char *argv[]) { char urlbuf[1024]; size_t n; int m, tcp; sip_t *sip; int exitcode = 0; msg_mclass_t const *sip_mclass = sip_default_mclass(); msg_t *msg = msg_create(sip_mclass, MSG_FLG_EXTRACT_COPY); msg_iovec_t iovec[1]; tcp = argv[1] && strcmp(argv[1], "-t") == 0; test_msg_class(sip_mclass); for (n = 0, m = 0;;) { if (msg_recv_iovec(msg, iovec, 1, 1, 0) < 0) { perror("msg_recv_iovec"); exit(1); } assert(iovec->mv_len >= 1); n = read(0, iovec->mv_base, 1); if (n < 0) { perror("test_sip_msg read"); exit(1); } msg_recv_commit(msg, n, n == 0); if (tcp) m = msg_extract(msg); if (n == 0 || m < 0) break; } if (!tcp) m = msg_extract(msg); sip = msg_object(msg); if (sip) fprintf(stdout, "sip flags = %x\n", sip->sip_flags); if (m < 0) { fprintf(stderr, "test_sip_msg: parsing error ("MOD_ZD")\n", n); exit(1); } if (sip->sip_flags & MSG_FLG_TRUNC) { fprintf(stderr, "test_sip_msg: message truncated\n"); exit(1); } if (msg_next(msg)) { fprintf(stderr, "test_sip_msg: stuff after message\n"); exit(1); } #if 0 fprintf(stderr, "test_sip_msg: %d headers (%d short ones), %d unknown\n", msg->mh_n_headers, msg->mh_n_short, msg->mh_n_unknown); if (msg->mh_payload) { fprintf(stderr, "\twith payload of %d bytes\n", msg->mh_payload->pl_len); } #endif if (MSG_HAS_ERROR(sip->sip_flags) || sip->sip_error) { fprintf(stderr, "test_sip_msg: parsing error\n"); exit(1); } else if (sip_sanity_check(sip) < 0) { fprintf(stderr, "test_sip_msg: message failed sanity check\n"); exit(1); } if (sip->sip_request) { fprintf(stdout, "\trequest %s (%d) %s %s\n", sip->sip_request->rq_method_name, sip->sip_request->rq_method, url_print(sip->sip_request->rq_url, urlbuf), sip->sip_request->rq_version); if (sip->sip_request->rq_url->url_type == url_unknown) { exitcode = 1; fprintf(stderr, "test_sip_msg: invalid request URI\n"); } } if (sip->sip_status) fprintf(stdout, "\tstatus %s %03d %s\n", sip->sip_status->st_version, sip->sip_status->st_status, sip->sip_status->st_phrase); if (sip->sip_cseq) fprintf(stdout, "\tCSeq: %u %s (%d)\n", sip->sip_cseq->cs_seq, sip->sip_cseq->cs_method_name, sip->sip_cseq->cs_method); if (sip->sip_call_id) fprintf(stdout, "\tCall-ID: %s (%x)\n", sip->sip_call_id->i_id, sip->sip_call_id->i_hash); if (sip->sip_from) fprintf(stdout, "\tFrom: %s@%s%s%s\n", sip->sip_from->a_user ? sip->sip_from->a_user : "******", sip->sip_from->a_host ? sip->sip_from->a_host : "[nowhere]", sip->sip_from->a_tag ? " ;tag=" : "", sip->sip_from->a_tag ? sip->sip_from->a_tag : ""); if (sip->sip_to) fprintf(stdout, "\tTo: %s@%s%s%s\n", sip->sip_to->a_user ? sip->sip_to->a_user : "******", sip->sip_to->a_host ? sip->sip_to->a_host : "[nowhere]", sip->sip_to->a_tag ? " ;tag=" : "", sip->sip_to->a_tag ? sip->sip_to->a_tag : ""); if (sip->sip_contact) print_contact(stdout, sip->sip_contact); if (sip->sip_via) print_via(stdout, sip->sip_via); if (sip->sip_content_length) { fprintf(stdout, "\tcontent length %u\n", sip->sip_content_length->l_length); } if (msg_next(msg)) { fprintf(stderr, "test_sip_msg: extra stuff after valid message\n"); exit(1); } return exitcode; }