static int roadmap_address_show (const char *city, const char *street_name, const char *street_number_image, RoadMapAddressDialog *context) { int i; int count; RoadMapGeocode *selections; char *state; const char *argv[4]; address_info ai; ai.state = NULL; ai.country = NULL; ai.city = city; ai.street = street_name; ai.house = street_number_image; state = "IL"; if (context->use_zip) { return 0; /* TBD: how to select by ZIP ? Need one more table in usdir. */ } ssd_dialog_hide_all(dec_close); count = roadmap_geocode_address (&selections, street_number_image, street_name, city, state); if (count <= 0) { roadmap_messagebox (roadmap_lang_get ("Warning"), roadmap_geocode_last_error_string()); free (selections); return 0; } argv[0] = street_number_image; argv[1] = street_name; argv[2] = city; argv[3] = state; roadmap_history_add ('A', argv); roadmap_history_save(); roadmap_address_done (selections, context, &ai); for (i = 0; i < count; ++i) { free (selections[i].name); selections[i].name = NULL; } free (selections); return 1; }
const char* on_create_poi_res(int NumParams,const char* pData){ char *argv[ahi__count]; void * history; int id; //ID pData = ReadIntFromString( pData, // [in] Source string ",\r\n", // [in,opt] Value termination NULL, // [in,opt] Allowed padding &id, // [out] Put it here TRIM_ALL_CHARS); // [in] Remove if (!pData){ roadmap_log( ROADMAP_ERROR, "Tripserver::on_create_poi_res() - Failed to read ID"); return NULL; } if (id > MAX_REQUESTS) return pData; roadmap_log( ROADMAP_DEBUG, "on_create_poi_res - id=%d",id ); history = g_request_cursors[id]; if (history == NULL) return pData; roadmap_history_get (ADDRESS_FAVORITE_CATEGORY, history, argv); roadmap_log( ROADMAP_DEBUG, "on_create_poi_res updating favorite id=%d name=%s",id, argv[ahi_name] ); argv[ahi_synced] = "true"; roadmap_history_update(history, ADDRESS_FAVORITE_CATEGORY, argv); roadmap_history_save(); g_request_cursors[id] = NULL; return pData; }
static void delete_callback(int exit_code, void *context){ /* We got a full address */ if (exit_code != dec_yes) return; roadmap_history_delete_entry (context ); roadmap_history_save (); ssd_generic_list_dialog_hide (); roadmap_address_history(); }
const char* on_get_pois_res(int NumParams,const char* pData){ int i; int iBufferSize; int longitude; int latitude; char poiName[MAX_POI_NAME]; char *argv[ahi__count]; char temp[20]; char msg[100]; int numRecords = NumParams/3; roadmap_log( ROADMAP_WARNING, "roadmap_tripserver_response- got GetPOIsRes (Num parameters= %d )",NumParams ); if (numRecords > 0) purge_old_favorites(); for (i = 0; i < numRecords; i++){ //POI name iBufferSize = sizeof(poiName); pData = ExtractNetworkString( pData, // [in] Source string poiName, // [out] Output buffer &iBufferSize, // [in,out] Buffer size / Size of extracted string ",", // [in] Array of chars to terminate the copy operation 1); // [in] Remove additional termination chars if (!pData){ roadmap_log( ROADMAP_ERROR, "Tripserver::on_get_pois_res() - Failed to read POI name"); return NULL; } //POI Lon pData = ReadIntFromString( pData, // [in] Source string ",", // [in,opt] Value termination NULL, // [in,opt] Allowed padding &longitude, // [out] Put it here 1); // [in] Remove if (!pData){ roadmap_log( ROADMAP_ERROR, "Tripserver::on_get_pois_res() - Failed to read Destination longitude. POI Name=%s",poiName ); return NULL; } //POI Lat pData = ReadIntFromString( pData, // [in] Source string ",\r\n", // [in,opt] Value termination NULL, // [in,opt] Allowed padding &latitude, // [out] Put it here TRIM_ALL_CHARS);// [in] Remove if (!pData){ roadmap_log( ROADMAP_ERROR, "Tripserver::on_get_pois_res() - Failed to read Destination latitude. POI Name=%s",poiName ); return NULL; } argv[ahi_house_number] = ""; argv[ahi_street] = ""; argv[ahi_city] = ""; argv[ahi_state] = ""; argv[ahi_name] = (char *)poiName; sprintf(temp, "%d", latitude); argv[ahi_latitude] = strdup(temp); sprintf(temp, "%d", longitude); argv[ahi_longtitude] = strdup(temp); argv[ahi_synced] = "true"; roadmap_log( ROADMAP_WARNING, "roadmap_tripserver_response- GetPOIsRes Adding favorite (name=%s, lat=%s, lon=%s )", argv[ahi_name], argv[ahi_latitude], argv[ahi_longtitude]); roadmap_history_add (ADDRESS_FAVORITE_CATEGORY, (const char **)argv); } ssd_progress_msg_dialog_hide(); if (numRecords == 0) sprintf(msg, "%s", roadmap_lang_get("No favorite destinations were found")); else if (numRecords == 1) sprintf(msg, "%s", roadmap_lang_get("1 destination was restored to your favorites")); else sprintf(msg, "%d %s", numRecords, roadmap_lang_get("destinations were restored to your favorites")); roadmap_messagebox_timeout("Favorites", msg, 5); roadmap_history_save(); return pData; }