--- extcalllog-0.6/src/main.c 2011-03-30 23:05:37.000000000 +0200 +++ extcalllog-0.6-callerid/src/main.c 2012-03-01 13:33:28.980772773 +0100 @@ -50,6 +50,8 @@ #include "filters.h" #include "he-about-dialog.h" +#include + #define CSD_CALL_BUS_NAME "com.nokia.csd.Call" #define CSD_CALL_INTERFACE "com.nokia.csd.Call" #define CSD_CALL_INSTANCE "com.nokia.csd.Call.Instance" @@ -217,6 +219,31 @@ DBUS_TYPE_INVALID); } +static void lookup_number(GtkButton* button, gpointer data) +{ + + int ret; + uint32_t flag = 0; + char * number = data; + /* fix 00 numbers for callerid */ + if((number[0]=='0'&&number[1]=='0')||number[1]=='+'){ + number=&number[1]; + number[0]='+'; + } + printf("lookup number %s", number); + printf("\n"); + + char* exec= "/usr/bin/callerid "; + char * command = malloc(strlen(exec) + strlen(number) + 1); + if ( command != NULL ) + { + strcpy(command, exec); + strcat(command, number); + system(command); + free(command); + } +} + static void delete_record(GtkButton* button, gpointer data) { g_debug("delete record..."); @@ -284,7 +311,7 @@ GtkWidget * timestamp_label, *end_timestamp_label; GtkWidget * icon_widget, * remote_details; GtkWidget * service_icon_widget, * local_details; - GtkWidget * delete_button, * call_button, * contact_button; + GtkWidget * delete_button, * call_button, * contact_button, * lookup_button; /* Get the information we want to display from the model. * @@ -468,6 +495,22 @@ } + /*only display lookup button if /usr/bin/callerid is present*/ + if( access( "/usr/bin/callerid", F_OK ) != -1 && strcmp(local_account, "ring/tel/ring") == 0 && (*remote_account != '\0') ) + { + lookup_button = gtk_button_new_with_label("Lookup Number"); + g_signal_connect( + G_OBJECT(lookup_button), + "clicked", + G_CALLBACK(lookup_number), + remote_account); + + gtk_box_pack_start(GTK_BOX(button_box), lookup_button, FALSE, FALSE, 0); + gtk_widget_show(lookup_button); + + } + + gtk_box_pack_start(GTK_BOX(main_box), timestamp_box, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(main_box), remote_box, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(main_box), local_box, FALSE, FALSE, 0);