Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release-src > by-pkgid > 42cc24834102223e1f61058b52fe73f5 > files > 1

modem-manager-gui-0.0.17.1-5.mga5.src.rpm

diff -ur modem-manager-gui-0.0.17.1/src/modules/mm06.c modem-manager-gui-0.0.18/src/modules/mm06.c
--- modem-manager-gui-0.0.17.1/src/modules/mm06.c	2014-08-27 14:45:55.000000000 +0400
+++ modem-manager-gui-0.0.18/src/modules/mm06.c	2014-11-17 21:50:30.706528000 +0300
@@ -2055,50 +2055,68 @@
 	index = 0;
 	
 	message = mmgui_smsdb_message_create();
-	//Sender number
+	
+	/*Sender number*/
 	value  = g_variant_lookup_value(messagev, "number", G_VARIANT_TYPE_STRING);
 	if (value != NULL) {
 		strlength = 256;
 		valuestr = g_variant_get_string(value, &strlength);
-		if (moduledata->needsmspolling) {
-			/*Old ModemManager versions tend to not bcd-decode sender numbers, doing it*/
-			decstr = (gchar *)bcd_to_utf8_ascii_part((const guchar *)valuestr, strlength, &declength);
-			if (decstr != NULL) {
-				mmgui_smsdb_message_set_number(message, decstr);
-				g_debug("SMS number: %s\n", decstr);
-				g_free(decstr);
+		if ((valuestr != NULL) && (valuestr[0] != '\0')) {
+			if (moduledata->needsmspolling) {
+				/*Old ModemManager versions tend to not bcd-decode sender numbers, doing it*/
+				decstr = (gchar *)bcd_to_utf8_ascii_part((const guchar *)valuestr, strlength, &declength);
+				if (decstr != NULL) {
+					mmgui_smsdb_message_set_number(message, decstr);
+					g_debug("SMS number: %s\n", decstr);
+					g_free(decstr);
+				} else {
+					mmgui_smsdb_message_set_number(message, valuestr);
+					g_debug("SMS number: %s\n", valuestr);
+				}
 			} else {
 				mmgui_smsdb_message_set_number(message, valuestr);
 				g_debug("SMS number: %s\n", valuestr);
 			}
-			
+		} else {
+			mmgui_smsdb_message_set_number(message, _("Unknown"));
 		}
 		g_variant_unref(value);
 	} else {
-		mmgui_smsdb_message_set_number(message, "--");
+		mmgui_smsdb_message_set_number(message, _("Unknown"));
 	}
-	//Service center number
+	
+	/*Service center number*/
 	value = g_variant_lookup_value(messagev, "smsc", G_VARIANT_TYPE_STRING);
 	if (value != NULL) {
 		strlength = 256;
 		valuestr = g_variant_get_string(value, &strlength);
-		mmgui_smsdb_message_set_service_number(message, valuestr);
-		g_debug("SMS service center number: %s\n", valuestr);
+		if ((valuestr != NULL) && (valuestr[0] != '\0')) {
+			mmgui_smsdb_message_set_service_number(message, valuestr);
+			g_debug("SMS service center number: %s\n", valuestr);
+		} else {
+			mmgui_smsdb_message_set_service_number(message, _("Unknown"));
+		}
 		g_variant_unref(value);
 	} else {
-		mmgui_smsdb_message_set_service_number(message, "--");
+		mmgui_smsdb_message_set_service_number(message, _("Unknown"));
 	}
-	//Decoded message text
+	
+	/*Try to get decoded message text first*/
 	gottext = FALSE;
 	value = g_variant_lookup_value(messagev, "text", G_VARIANT_TYPE_STRING);
 	if (value != NULL) {
 		strlength = 256*160;
 		valuestr = g_variant_get_string(value, &strlength);
-		g_debug("SMS text: %s\n", valuestr);
-		mmgui_smsdb_message_set_text(message, valuestr, FALSE);
-		gottext = TRUE;
+		if ((valuestr != NULL) && (valuestr[0] != '\0')) {
+			mmgui_smsdb_message_set_text(message, valuestr, FALSE);
+			gottext = TRUE;
+			g_debug("SMS text: %s\n", valuestr);
+		}
 		g_variant_unref(value);
-	} else {
+	}
+	
+	/*If there is no text (message isn't decoded), try to get binary data*/
+	if (!gottext) {
 		value = g_variant_lookup_value(messagev, "data", G_VARIANT_TYPE_BYTESTRING);
 		if (value != NULL) {
 			strlength = g_variant_get_size(value);
@@ -2111,24 +2129,28 @@
 			g_variant_unref(value);
 		}
 	}
-	//Message timestamp (ModemManager uses string, Wader uses double)
+	
+	/*Message timestamp (ModemManager uses string, Wader uses double)*/
 	if (moduledata->service == MODULE_INT_SERVICE_MODEM_MANAGER) {
 		value = g_variant_lookup_value(messagev, "timestamp", G_VARIANT_TYPE_STRING);
 		if (value != NULL) {
 			strlength = 256;
 			valuestr = g_variant_get_string(value, &strlength);
-			mmgui_smsdb_message_set_timestamp(message, mmgui_module_str_to_time(valuestr));
-			//g_debug("SMS timestamp: %ul\n", message->timestamp);
+			if ((valuestr != NULL) && (valuestr[0] != '\0')) {
+				mmgui_smsdb_message_set_timestamp(message, mmgui_module_str_to_time(valuestr));
+				g_debug("SMS timestamp: %s", ctime((const time_t *)&message->timestamp));
+			}
 			g_variant_unref(value);
 		}
 	} else if (moduledata->service == MODULE_INT_SERVICE_WADER) {
 		value = g_variant_lookup_value(messagev, "timestamp", G_VARIANT_TYPE_DOUBLE);
 		if (value != NULL) {
 			mmgui_smsdb_message_set_timestamp(message, (time_t)g_variant_get_double(value));
-			//g_debug("SMS timestamp: %ul\n", message->timestamp);
+			g_debug("SMS timestamp: %s", ctime((const time_t *)&message->timestamp));
 			g_variant_unref(value);
 		}
 	}
+	
 	/*Message index (ModemManager uses unsigned integer, Wader uses signed one.)
 	  This is a critical parameter, so message will be skipped if index value unknown.*/
 	gotindex = FALSE;
@@ -2136,27 +2158,28 @@
 		value = g_variant_lookup_value(messagev, "index", G_VARIANT_TYPE_UINT32);
 		if (value != NULL) {
 			index = g_variant_get_uint32(value);
-			g_variant_unref(value);
+			mmgui_smsdb_message_set_identifier(message, index, FALSE);
+			g_debug("SMS index: %u\n", index);
 			gotindex = TRUE;
+			g_variant_unref(value);
 		}
 	} else if (moduledata->service == MODULE_INT_SERVICE_WADER) {
 		value = g_variant_lookup_value(messagev, "index", G_VARIANT_TYPE_INT32);
 		if (value != NULL) {
 			index = (guint)g_variant_get_int32(value);
-			g_variant_unref(value);
+			mmgui_smsdb_message_set_identifier(message, index, FALSE);
+			g_debug("SMS index: %u\n", index);
 			gotindex = TRUE;
+			g_variant_unref(value);
 		}
 	}
 	
 	if ((!gotindex) || (!gottext)) {
-		//Message identifier unknown or no text - skip it
+		/*Message identifier unknown or no text - skip it*/
 		mmgui_smsdb_message_free(message);
 		return NULL;
 	}
 	
-	//Return message
-	mmgui_smsdb_message_set_identifier(message, index, FALSE);
-	g_debug("SMS index: %u\n", index);
 	return message;
 }
 
diff -ur modem-manager-gui-0.0.17.1/src/modules/mm07.c modem-manager-gui-0.0.18/src/modules/mm07.c
--- modem-manager-gui-0.0.17.1/src/modules/mm07.c	2014-08-19 03:09:12.000000000 +0400
+++ modem-manager-gui-0.0.18/src/modules/mm07.c	2014-11-17 21:50:50.211323000 +0300
@@ -2341,15 +2341,14 @@
 	if ((smsproxy == NULL) && (error != NULL)) {
 		mmgui_module_handle_error_message(mmguicore, error);
 		g_error_free(error);
-		//g_object_unref(smsproxy);
 		return NULL;
 	}
 	
-	//SMS message state
+	/*SMS message state*/
 	value  = g_dbus_proxy_get_cached_property(smsproxy, "State");
 	if (value != NULL) {
 		state = g_variant_get_uint32(value);
-		//g_printf("STATE: %u\n", state);		
+		g_debug("STATE: %u\n", state);
 		if (state != MODULE_INT_SMS_STATE_RECEIVED) {
 			/*//Message is not fully received - skip it and add to list if needed
 			if ((state == MODULE_INT_SMS_STATE_RECEIVING) && (listpartial)) {
@@ -2361,64 +2360,79 @@
 		}
 		g_variant_unref(value);
 	} else {
-		//Something strange with this message - skip it
+		/*Something strange with this message - skip it*/
 		g_object_unref(smsproxy);
 		return NULL;
 	}
 	
-	//SMS message type
+	/*SMS message type*/
 	value  = g_dbus_proxy_get_cached_property(smsproxy, "PduType");
 	if (value != NULL) {
 		state = g_variant_get_uint32(value);
-		//g_printf("PDU: %u\n", state);		
+		g_debug("PDU: %u\n", state);
 		if ((state == MODULE_INT_PDU_TYPE_UNKNOWN) || (state == MODULE_INT_PDU_TYPE_SUBMIT)) {
-			//Only delivered messages and status reports needed this moment - maybe remove other?
-			//TODO: remove message
+			/*Only delivered messages and status reports needed this moment - maybe remove other?*/
 			g_variant_unref(value);
 			g_object_unref(smsproxy);
 			return NULL;
 		}
 		g_variant_unref(value);
 	} else {
-		//Something strange with this message - skip it
+		/*Something strange with this message - skip it*/
 		g_object_unref(smsproxy);
 		return NULL;
 	}
 		
 	message = mmgui_smsdb_message_create();
-	//Sender number
+	
+	/*Sender number*/
 	value  = g_dbus_proxy_get_cached_property(smsproxy, "Number");
 	if (value != NULL) {
 		strlength = 256;
 		valuestr = g_variant_get_string(value, &strlength);
-		mmgui_smsdb_message_set_number(message, valuestr);
-		//g_printf("SMS number: %s\n", valuestr);
+		if ((valuestr != NULL) && (valuestr[0] != '\0')) {
+			mmgui_smsdb_message_set_number(message, valuestr);
+			g_debug("SMS number: %s\n", valuestr);
+		} else {
+			mmgui_smsdb_message_set_number(message, _("Unknown"));
+		}
 		g_variant_unref(value);
 	} else {
 		mmgui_smsdb_message_set_number(message, _("Unknown"));
 	}
-	//Service center number
+	
+	/*Service center number*/
 	value = g_dbus_proxy_get_cached_property(smsproxy, "SMSC");
 	if (value != NULL) {
 		strlength = 256;
 		valuestr = g_variant_get_string(value, &strlength);
-		mmgui_smsdb_message_set_service_number(message, valuestr);
-		//g_printf("SMS service number: %s\n", valuestr);
+		if ((valuestr != NULL) && (valuestr[0] != '\0')) {
+			mmgui_smsdb_message_set_service_number(message, valuestr);
+			g_debug("SMS service number: %s\n", valuestr);
+		} else {
+			mmgui_smsdb_message_set_service_number(message, _("Unknown"));
+		}
 		g_variant_unref(value);
 	} else {
 		mmgui_smsdb_message_set_service_number(message, _("Unknown"));
 	}
-	//Decoded message text
+	
+	/*Try to get decoded message text first*/
 	gottext = FALSE;
 	value = g_dbus_proxy_get_cached_property(smsproxy, "Text");
 	if (value != NULL) {
 		strlength = 256*160;
 		valuestr = g_variant_get_string(value, &strlength);
-		//g_printf("SMS text: %s\n", valuestr);
-		mmgui_smsdb_message_set_text(message, valuestr, FALSE);
-		gottext = TRUE;
+		if ((valuestr != NULL) && (valuestr[0] != '\0')) {
+			mmgui_smsdb_message_set_text(message, valuestr, FALSE);
+			gottext = TRUE;
+			g_debug("SMS text: %s\n", valuestr);
+		}	
 		g_variant_unref(value);
-	} else {
+	}
+	
+	/*If there is no text (message isn't decoded), try to get binary data*/
+	if (!gottext) {
 		value = g_dbus_proxy_get_cached_property(smsproxy, "Data");
 		if (value != NULL) {
 			strlength = g_variant_get_size(value);
@@ -2431,28 +2445,31 @@
 			g_variant_unref(value);
 		}
 	}
-	//Message timestamp
+	
+	/*No valuable information at all, skip message*/
+	if (!gottext) {
+		mmgui_smsdb_message_free(message);
+		return NULL;
+	}
+	
+	/*Message timestamp*/
 	value = g_dbus_proxy_get_cached_property(smsproxy, "Timestamp");
 	if (value != NULL) {
 		strlength = 256;
 		valuestr = g_variant_get_string(value, &strlength);
-		mmgui_smsdb_message_set_timestamp(message, mmgui_module_str_to_time(valuestr));
-		//g_printf("SMS timestamp: %lu\n", (gulong)message->timestamp);
+		if ((valuestr != NULL) && (valuestr[0] != '\0')) {
+			mmgui_smsdb_message_set_timestamp(message, mmgui_module_str_to_time(valuestr));
+			g_debug("SMS timestamp: %s", ctime((const time_t *)&message->timestamp));
+		}
 		g_variant_unref(value);
 	}
-	//Message index
+	
+	/*Message index*/
 	index = mmgui_module_get_object_path_index(smspath);
-	//Return message
-	if (!gottext) {
-		//Message has no text - skip it
-		mmgui_smsdb_message_free(message);
-		return NULL;
-	} else {
-		//Return message
-		mmgui_smsdb_message_set_identifier(message, index, FALSE);
-		//g_printf("SMS index: %u\n", index);
-		return message;
-	}
+	mmgui_smsdb_message_set_identifier(message, index, FALSE);
+	g_debug("SMS index: %u\n", index);
+	
+	return message;
 }
 
 static gint mmgui_module_sms_get_id(mmguicore_t mmguicore, const gchar *smspath)
diff -ur modem-manager-gui-0.0.17.1/src/modules/ofono109.c modem-manager-gui-0.0.18/src/modules/ofono109.c
--- modem-manager-gui-0.0.17.1/src/modules/ofono109.c	2014-08-27 15:17:22.000000000 +0400
+++ modem-manager-gui-0.0.18/src/modules/ofono109.c	2014-12-17 22:12:46.640030000 +0300
@@ -178,7 +178,7 @@
 				if (devtypev != NULL) {
 					typestrsize = 256;
 					typestr = g_variant_get_string(devtypev, &typestrsize);
-					if (typestr != NULL) {
+					if ((typestr != NULL) && (typestr[0] != '\0')) {
 						if (g_str_equal(typestr, "hardware")) {
 							devreal = TRUE;
 						}
@@ -190,7 +190,7 @@
 					/*Determine path and add device to queue*/
 					devpathsize = 256;
 					devpath = g_variant_get_string(devpathv, &devpathsize);
-					if (devpath != NULL) {
+					if ((devpath != NULL) && (devpath[0] != '\0')) {
 						moduledata->devqueue = g_list_prepend(moduledata->devqueue, g_strdup(devpath));
 					}
 				}
@@ -237,7 +237,7 @@
 			strsize = 256;
 			parameter = g_variant_get_string(propname, &strsize);
 			value = g_variant_get_variant(propvalue);
-			if ((parameter != NULL) && (value != NULL)) {
+			if ((parameter != NULL) && (parameter[0] != '\0') && (value != NULL)) {
 				g_debug("SIGNAL: %s: %s\n", parameter, g_variant_print(value, TRUE));
 				if (g_str_equal(parameter, "Strength")) {
 					//Signal level
@@ -251,72 +251,79 @@
 					//Registration state
 					if (mmguicore->device != NULL) {
 						strsize = 256;
-						mmguicore->device->regstatus = mmgui_module_registration_status_translate(g_variant_get_string(value, &strsize));
-						if (mmguicore->eventcb != NULL) {
-							(mmguicore->eventcb)(MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, mmguicore, mmguicore->device);
+						parameter = g_variant_get_string(value, &strsize);
+						if ((parameter != NULL) && (parameter[0] != '\0')) {
+							mmguicore->device->regstatus = mmgui_module_registration_status_translate(parameter);
+							if (mmguicore->eventcb != NULL) {
+								(mmguicore->eventcb)(MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, mmguicore, mmguicore->device);
+							}
 						}
 					}
 				} else if (g_str_equal(parameter, "MobileCountryCode")) {
 					//Registration state
 					if (mmguicore->device != NULL) {
-						/*Operator code*/
-						strsize = 256;
-						mmguicore->device->operatorcode |= (atoi(g_variant_get_string(value, &strsize)) & 0x0000ffff) << 16;
-						/*Location*/
 						strsize = 256;
-						mmguicore->device->loc3gppdata[0] = atoi(g_variant_get_string(value, &strsize));
-						oldlocation = moduledata->location;
-						moduledata->location |= MODULE_INT_MODEM_LOCATION_MCC;
-						if (moduledata->location == MODULE_INT_MODEM_LOCATION_ALL) {
-							mmguicore->device->locationcaps |= MMGUI_LOCATION_CAPS_3GPP;
-							/*Location capabilities updated*/
-							if ((oldlocation != MODULE_INT_MODEM_LOCATION_ALL) && (mmguicore->eventcb != NULL)) {
-								(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_LOCATION));
-							}
-							/*Update location*/
-							if (mmguicore->eventcb != NULL) {
-								(mmguicore->eventcb)(MMGUI_EVENT_LOCATION_CHANGE, mmguicore, mmguicore->device);
-							}
+						parameter = g_variant_get_string(value, &strsize);
+						if ((parameter != NULL) && (parameter[0] != '\0')) {
+							/*Operator code*/
+							mmguicore->device->operatorcode |= (atoi(parameter) & 0x0000ffff) << 16;
+							/*Location*/
+							mmguicore->device->loc3gppdata[0] = atoi(parameter);
+							oldlocation = moduledata->location;
+							moduledata->location |= MODULE_INT_MODEM_LOCATION_MCC;
+							if (moduledata->location == MODULE_INT_MODEM_LOCATION_ALL) {
+								mmguicore->device->locationcaps |= MMGUI_LOCATION_CAPS_3GPP;
+								/*Location capabilities updated*/
+								if ((oldlocation != MODULE_INT_MODEM_LOCATION_ALL) && (mmguicore->eventcb != NULL)) {
+									(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_LOCATION));
+								}
+								/*Update location*/
+								if (mmguicore->eventcb != NULL) {
+									(mmguicore->eventcb)(MMGUI_EVENT_LOCATION_CHANGE, mmguicore, mmguicore->device);
+								}
 							
-						} 
-						if ((moduledata->location & MODULE_INT_MODEM_LOCATION_MCC) && (moduledata->location & MODULE_INT_MODEM_LOCATION_MNC)) {
-							/*Update operator code*/
-							if (mmguicore->eventcb != NULL) {
-								(mmguicore->eventcb)(MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, mmguicore, mmguicore->device);
+							}
+							if ((moduledata->location & MODULE_INT_MODEM_LOCATION_MCC) && (moduledata->location & MODULE_INT_MODEM_LOCATION_MNC)) {
+								/*Update operator code*/
+								if (mmguicore->eventcb != NULL) {
+									(mmguicore->eventcb)(MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, mmguicore, mmguicore->device);
+								}
 							}
 						}
 					}
 				}  else if (g_str_equal(parameter, "MobileNetworkCode")) {
-					//Registration state
+					/*Registration state*/
 					if (mmguicore->device != NULL) {
-						/*Operator code*/
 						strsize = 256;
-						mmguicore->device->operatorcode |= atoi(g_variant_get_string(value, &strsize)) & 0x0000ffff;
-						//Location
-						strsize = 256;
-						mmguicore->device->loc3gppdata[1] = atoi(g_variant_get_string(value, &strsize));
-						oldlocation = moduledata->location;
-						moduledata->location |= MODULE_INT_MODEM_LOCATION_MNC;
-						if (moduledata->location == MODULE_INT_MODEM_LOCATION_ALL) {
-							mmguicore->device->locationcaps |= MMGUI_LOCATION_CAPS_3GPP;
-							/*Location capabilities updated*/
-							if ((oldlocation != MODULE_INT_MODEM_LOCATION_ALL) && (mmguicore->eventcb != NULL)) {
-								(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_LOCATION));
-							}
-							/*Update location*/
-							if (mmguicore->eventcb != NULL) {
-								(mmguicore->eventcb)(MMGUI_EVENT_LOCATION_CHANGE, mmguicore, mmguicore->device);
+						parameter = g_variant_get_string(value, &strsize);
+						if ((parameter != NULL) && (parameter[0] != '\0')) {
+							/*Operator code*/
+							mmguicore->device->operatorcode |= atoi(parameter) & 0x0000ffff;
+							/*Location*/
+							mmguicore->device->loc3gppdata[1] = atoi(parameter);
+							oldlocation = moduledata->location;
+							moduledata->location |= MODULE_INT_MODEM_LOCATION_MNC;
+							if (moduledata->location == MODULE_INT_MODEM_LOCATION_ALL) {
+								mmguicore->device->locationcaps |= MMGUI_LOCATION_CAPS_3GPP;
+								/*Location capabilities updated*/
+								if ((oldlocation != MODULE_INT_MODEM_LOCATION_ALL) && (mmguicore->eventcb != NULL)) {
+									(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_LOCATION));
+								}
+								/*Update location*/
+								if (mmguicore->eventcb != NULL) {
+									(mmguicore->eventcb)(MMGUI_EVENT_LOCATION_CHANGE, mmguicore, mmguicore->device);
+								}
 							}
-						}
-						if ((moduledata->location & MODULE_INT_MODEM_LOCATION_MCC) && (moduledata->location & MODULE_INT_MODEM_LOCATION_MNC)) {
-							/*Update operator code*/
-							if (mmguicore->eventcb != NULL) {
-								(mmguicore->eventcb)(MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, mmguicore, mmguicore->device);
+							if ((moduledata->location & MODULE_INT_MODEM_LOCATION_MCC) && (moduledata->location & MODULE_INT_MODEM_LOCATION_MNC)) {
+								/*Update operator code*/
+								if (mmguicore->eventcb != NULL) {
+									(mmguicore->eventcb)(MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, mmguicore, mmguicore->device);
+								}
 							}
 						}
 					}
 				} else if (g_str_equal(parameter, "LocationAreaCode")) {
-					//Location
+					/*Location*/
 					if (mmguicore->device != NULL) {
 						mmguicore->device->loc3gppdata[2] = g_variant_get_uint16(value);
 						oldlocation = moduledata->location;
@@ -334,7 +341,7 @@
 						}
 					}
 				} else if (g_str_equal(parameter, "CellId")) {
-					//Location
+					/*Location*/
 					if (mmguicore->device != NULL) {
 						mmguicore->device->loc3gppdata[3] = g_variant_get_uint32(value);
 						oldlocation = moduledata->location;
@@ -352,24 +359,30 @@
 						}
 					}
 				} else if (g_str_equal(parameter, "Name")) {
-					//Registration state
+					/*Registration state*/
 					if (mmguicore->device != NULL) {
 						if (mmguicore->device->operatorname != NULL) {
 							g_free(mmguicore->device->operatorname);
 						}
 						strsize = 256;
-						mmguicore->device->operatorname = g_strdup(g_variant_get_string(value, &strsize));
-						if (mmguicore->eventcb != NULL) {
-							(mmguicore->eventcb)(MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, mmguicore, mmguicore->device);
+						parameter = g_variant_get_string(value, &strsize);
+						if ((parameter != NULL) && (parameter[0] != '\0')) {
+							mmguicore->device->operatorname = g_strdup(parameter);
+							if (mmguicore->eventcb != NULL) {
+								(mmguicore->eventcb)(MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, mmguicore, mmguicore->device);
+							}
 						}
 					}
 				} else if (g_str_equal(parameter, "Technology")) {
-					//Network mode
+					/*Network mode*/
 					if (mmguicore->device != NULL) {
 						strsize = 256;
-						mmguicore->device->mode = mmgui_module_access_mode_translate(g_variant_get_string(value, &strsize));
-						if (mmguicore->eventcb != NULL) {
-							(mmguicore->eventcb)(MMGUI_EVENT_NETWORK_MODE_CHANGE, mmguicore, mmguicore->device);
+						parameter = g_variant_get_string(value, &strsize);
+						if ((parameter != NULL) && (parameter[0] != '\0')) {
+							mmguicore->device->mode = mmgui_module_access_mode_translate(parameter);
+							if (mmguicore->eventcb != NULL) {
+								(mmguicore->eventcb)(MMGUI_EVENT_NETWORK_MODE_CHANGE, mmguicore, mmguicore->device);
+							}
 						}
 					}
 				}
@@ -406,43 +419,46 @@
 			strsize = 256;
 			parameter = g_variant_get_string(propname, &strsize);
 			value = g_variant_get_variant(propvalue);
-			if ((parameter != NULL) && (value != NULL)) {
+			if ((parameter != NULL) && (parameter[0] != '\0') && (value != NULL)) {
 				if (g_str_equal(parameter, "Interfaces")) {
 					if (mmguicore->device != NULL) {
 						g_variant_iter_init(&iterl1, value);
 						while ((nodel1 = g_variant_iter_next_value(&iterl1)) != NULL) {
+							strsize = 256;
 							interface = g_variant_get_string(nodel1, &strsize);
-							if ((moduledata->netproxy == NULL) && (g_str_equal(interface, "org.ofono.NetworkRegistration"))) {
-								if (mmgui_module_open_network_registration_interface(mmguicore, mmguicore->device)) {
-									/*Scan capabilities updated*/
-									if (mmguicore->eventcb != NULL) {
-										(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_SCAN));
+							if ((interface != NULL) && (interface[0] != '\0')) {
+								if ((moduledata->netproxy == NULL) && (g_str_equal(interface, "org.ofono.NetworkRegistration"))) {
+									if (mmgui_module_open_network_registration_interface(mmguicore, mmguicore->device)) {
+										/*Scan capabilities updated*/
+										if (mmguicore->eventcb != NULL) {
+											(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_SCAN));
+										}
+										mmgui_module_devices_information(mmguicore);
 									}
-									mmgui_module_devices_information(mmguicore);
-								}
-							} else if ((moduledata->cardproxy == NULL) && (g_str_equal(interface, "org.ofono.SimManager"))) {
-								if (mmgui_module_open_sim_manager_interface(mmguicore, mmguicore->device)) {
-									mmgui_module_devices_information(mmguicore);
-								}
-							} else if ((moduledata->smsproxy == NULL) && (g_str_equal(interface, "org.ofono.MessageManager"))) {
-								if (mmgui_module_open_message_manager_interface(mmguicore, mmguicore->device)) {
-									/*SMS messaging capabilities updated*/
-									if (mmguicore->eventcb != NULL) {
-										(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_SMS));
+								} else if ((moduledata->cardproxy == NULL) && (g_str_equal(interface, "org.ofono.SimManager"))) {
+									if (mmgui_module_open_sim_manager_interface(mmguicore, mmguicore->device)) {
+										mmgui_module_devices_information(mmguicore);
 									}
-								}
-							} else if ((moduledata->ussdproxy == NULL) && (g_str_equal(interface, "org.ofono.SupplementaryServices"))) {
-								if (mmgui_module_open_supplementary_services_interface(mmguicore, mmguicore->device)) {
-									/*Supplimentary services capabilities updated*/
-									if (mmguicore->eventcb != NULL) {
-										(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_USSD));
+								} else if ((moduledata->smsproxy == NULL) && (g_str_equal(interface, "org.ofono.MessageManager"))) {
+									if (mmgui_module_open_message_manager_interface(mmguicore, mmguicore->device)) {
+										/*SMS messaging capabilities updated*/
+										if (mmguicore->eventcb != NULL) {
+											(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_SMS));
+										}
 									}
-								}
-							} else if ((moduledata->contactsproxy == NULL) && (g_str_equal(interface, "org.ofono.Phonebook"))) {
-								if (mmgui_module_open_phonebook_interface(mmguicore, mmguicore->device)) {
-									/*Contacts capabilities updated*/
-									if (mmguicore->eventcb != NULL) {
-										(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_CONTACTS));
+								} else if ((moduledata->ussdproxy == NULL) && (g_str_equal(interface, "org.ofono.SupplementaryServices"))) {
+									if (mmgui_module_open_supplementary_services_interface(mmguicore, mmguicore->device)) {
+										/*Supplimentary services capabilities updated*/
+										if (mmguicore->eventcb != NULL) {
+											(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_USSD));
+										}
+									}
+								} else if ((moduledata->contactsproxy == NULL) && (g_str_equal(interface, "org.ofono.Phonebook"))) {
+									if (mmgui_module_open_phonebook_interface(mmguicore, mmguicore->device)) {
+										/*Contacts capabilities updated*/
+										if (mmguicore->eventcb != NULL) {
+											(mmguicore->eventcb)(MMGUI_EVENT_EXTEND_CAPABILITIES, mmguicore, GINT_TO_POINTER(MMGUI_CAPS_CONTACTS));
+										}
 									}
 								}
 							}
@@ -658,26 +674,20 @@
 		return FALSE;
 	}
 	
+	enabled = FALSE;
+	
 	/*Properties dictionary (not dbus properties)*/
 	propdict = g_variant_get_child_value(deviceinfo, 0);
-	if (propdict == NULL) {
-		g_variant_unref(deviceinfo);
-		return FALSE;
-	}
-	
-	propenabled = g_variant_lookup_value(propdict, "Online", G_VARIANT_TYPE_BOOLEAN);
-	if (propenabled == NULL) {
+	if (propdict != NULL) {
+		propenabled = g_variant_lookup_value(propdict, "Online", G_VARIANT_TYPE_BOOLEAN);
+		if (propenabled != NULL) {
+			enabled = g_variant_get_boolean(propenabled);
+			g_variant_unref(propenabled);
+		}
 		g_variant_unref(propdict);
-		g_variant_unref(deviceinfo);
-		return FALSE;
 	}
-	
-	enabled = g_variant_get_boolean(propenabled);
-	
-	g_variant_unref(propenabled);
-	g_variant_unref(propdict);
 	g_variant_unref(deviceinfo);
-		
+	
 	return enabled;
 }
 
@@ -716,40 +726,28 @@
 		return FALSE;
 	}
 	
+	locked = FALSE;
+	
 	/*Properties dictionary (not dbus properties)*/
 	propdict = g_variant_get_child_value(deviceinfo, 0);
-	if (propdict == NULL) {
-		g_variant_unref(deviceinfo);
-		return FALSE;
-	}
-	
-	proplocked = g_variant_lookup_value(propdict, "PinRequired", G_VARIANT_TYPE_STRING);
-	if (proplocked == NULL) {
-		g_variant_unref(propdict);
-		g_variant_unref(deviceinfo);
-		return FALSE;
-	}
-	
-	pinstringsize = 256;
-	pinstring = g_variant_get_string(proplocked, &pinstringsize);
-	
-	if (pinstring == NULL) {
-		g_variant_unref(proplocked);
+	if (propdict != NULL) {
+		proplocked = g_variant_lookup_value(propdict, "PinRequired", G_VARIANT_TYPE_STRING);
+		if (proplocked != NULL) {
+			pinstringsize = 256;
+			pinstring = g_variant_get_string(proplocked, &pinstringsize);
+			if ((pinstring != NULL) && (pinstring[0] != '\0')) {
+				if (g_str_equal(pinstring, "none")) {
+					locked = FALSE;
+				} else {
+					locked = TRUE;
+				}
+			}
+			g_variant_unref(proplocked);
+		}
 		g_variant_unref(propdict);
-		g_variant_unref(deviceinfo);
-		return FALSE;
-	} 
-	
-	if (g_str_equal(pinstring, "none")) {
-		locked = FALSE;
-	} else {
-		locked = TRUE;
 	}
-	
-	g_variant_unref(proplocked);
-	g_variant_unref(propdict);
 	g_variant_unref(deviceinfo);
-		
+	
 	return locked;
 }
 
@@ -788,38 +786,26 @@
 		return FALSE;
 	}
 	
+	registered = FALSE;
+	
 	/*Properties dictionary (not dbus properties)*/
 	propdict = g_variant_get_child_value(deviceinfo, 0);
-	if (propdict == NULL) {
-		g_variant_unref(deviceinfo);
-		return FALSE;
-	}
-	
-	propreg = g_variant_lookup_value(propdict, "Status", G_VARIANT_TYPE_STRING);
-	if (propreg == NULL) {
-		g_variant_unref(propdict);
-		g_variant_unref(deviceinfo);
-		return FALSE;
-	}
-	
-	regstrsize = 256;
-	regstr = g_variant_get_string(propreg, &regstrsize);
-	
-	if (regstr == NULL) {
-		g_variant_unref(propreg);
+	if (propdict != NULL) {
+		propreg = g_variant_lookup_value(propdict, "Status", G_VARIANT_TYPE_STRING);
+		if (propreg != NULL) {
+			regstrsize = 256;
+			regstr = g_variant_get_string(propreg, &regstrsize);
+			if ((regstr != NULL) && (regstr[0] != '\0')) {
+				if (g_str_equal(regstr, "registered") || g_str_equal(regstr, "roaming")) {
+					registered = TRUE;
+				} else {
+					registered = FALSE;
+				}
+			}
+			g_variant_unref(propreg);
+		}
 		g_variant_unref(propdict);
-		g_variant_unref(deviceinfo);
-		return FALSE;
-	}
-	
-	if (g_str_equal(regstr, "registered") || g_str_equal(regstr, "roaming")) {
-		registered = TRUE;
-	} else {
-		registered = FALSE;
 	}
-	
-	g_variant_unref(propreg);
-	g_variant_unref(propdict);
 	g_variant_unref(deviceinfo);
 	
 	return registered;
@@ -952,7 +938,7 @@
 	GVariantIter iterl1;
 	GVariant *nodel1;
 	gsize strsize;
-	const gchar *interface;
+	const gchar *parameter;
 	
 	if ((mmguicore == NULL) || (devpath == NULL) || (devprops == NULL)) return NULL;
 	
@@ -1016,7 +1002,12 @@
 	devprop = g_variant_lookup_value(devprops, "Manufacturer", G_VARIANT_TYPE_STRING);
 	if (devprop != NULL) {
 		strsize = 256;
-		device->manufacturer = g_strdup(g_variant_get_string(devprop, &strsize));
+		parameter = g_variant_get_string(devprop, &strsize);
+		if ((parameter != NULL) && (parameter[0] != '\0')) {
+			device->manufacturer = g_strdup(parameter);
+		} else {
+			device->manufacturer = g_strdup(_("Unknown"));
+		}
 		g_variant_unref(devprop);
 	} else {
 		device->manufacturer = g_strdup(_("Unknown"));
@@ -1025,7 +1016,12 @@
 	devprop = g_variant_lookup_value(devprops, "Model", G_VARIANT_TYPE_STRING);
 	if (devprop != NULL) {
 		strsize = 256;
-		device->model = g_strdup(g_variant_get_string(devprop, &strsize));
+		parameter = g_variant_get_string(devprop, &strsize);
+		if ((parameter != NULL) && (parameter[0] != '\0')) {
+			device->model = g_strdup(parameter);
+		} else {
+			device->model = g_strdup(_("Unknown"));
+		}
 		g_variant_unref(devprop);
 	} else {
 		device->model = g_strdup(_("Unknown"));
@@ -1034,7 +1030,12 @@
 	devprop = g_variant_lookup_value(devprops, "Revision", G_VARIANT_TYPE_STRING);
 	if (devprop != NULL) {
 		strsize = 256;
-		device->version = g_strdup(g_variant_get_string(devprop, &strsize));
+		parameter = g_variant_get_string(devprop, &strsize);
+		if ((parameter != NULL) && (parameter[0] != '\0')) {
+			device->version = g_strdup(parameter);
+		} else {
+			device->version = g_strdup(_("Unknown"));
+		}
 		g_variant_unref(devprop);
 	} else {
 		device->version = g_strdup(_("Unknown"));
@@ -1057,19 +1058,21 @@
 		g_variant_iter_init(&iterl1, interfaces);
 		while ((nodel1 = g_variant_iter_next_value(&iterl1)) != NULL) {
 			strsize = 256;
-			interface = g_variant_get_string(nodel1, &strsize);
-			if ((g_str_equal(interface, "org.ofono.cdma.ConnectionManager")) || (g_str_equal(interface, "org.ofono.cdma.VoiceCallManager"))) {
-				device->type = MMGUI_DEVICE_TYPE_CDMA;
-				break;
+			parameter = g_variant_get_string(nodel1, &strsize);
+			if ((parameter != NULL) && (parameter[0] != '\0')) {
+				if ((g_str_equal(parameter, "org.ofono.cdma.ConnectionManager")) || (g_str_equal(parameter, "org.ofono.cdma.VoiceCallManager"))) {
+					device->type = MMGUI_DEVICE_TYPE_CDMA;
+					break;
+				}
 			}					
 			g_variant_unref(nodel1);
 		}
 	}
 	
-	//Persistent device identifier
-	interface = g_strdup_printf("%s_%s_%s", device->manufacturer, device->model, device->version);
-	device->persistentid = g_compute_checksum_for_string(G_CHECKSUM_MD5, interface, -1);
-	g_free((gchar *)interface);
+	/*Persistent device identifier*/
+	parameter = g_strdup_printf("%s_%s_%s", device->manufacturer, device->model, device->version);
+	device->persistentid = g_compute_checksum_for_string(G_CHECKSUM_MD5, parameter, -1);
+	g_free((gchar *)parameter);
 	
 	return device;
 }
@@ -1308,14 +1311,14 @@
 			if ((devpathv != NULL) && (devprops != NULL)) {
 				devpathsize = 256;
 				devpath = g_variant_get_string(devpathv, &devpathsize);
-				if ((devpath != NULL) && (devprops != NULL)) {
+				if ((devpath != NULL) && (devpath[0] != '\0')) {
 					/*Determine if modem is not emulated*/
 					devreal = FALSE;
 					devtypev = g_variant_lookup_value(devprops, "Type", G_VARIANT_TYPE_STRING);
 					if (devtypev != NULL) {
 						typestrsize = 256;
 						typestr = g_variant_get_string(devtypev, &typestrsize);
-						if (typestr != NULL) {
+						if ((typestr != NULL) && (typestr[0] != '\0')) {
 							if (g_str_equal(typestr, "hardware")) {
 								devreal = TRUE;
 							}
@@ -1492,6 +1495,7 @@
 	//gchar opcode[6];
 	//guchar locvalues;
 	gsize strsize = 256;
+	const gchar *parameter;
 	
 	if (mmguicore == NULL) return FALSE;
 	mmguicorelc = (mmguicore_t)mmguicore;
@@ -1518,7 +1522,12 @@
 			data = mmgui_module_proxy_get_property(moduledata->modemproxy, "Serial", G_VARIANT_TYPE_STRING);
 			if (data != NULL) {
 				strsize = 256;
-				device->imei = g_strdup(g_variant_get_string(data, &strsize));
+				parameter = g_variant_get_string(data, &strsize);
+				if ((parameter != NULL) && (parameter[0] != '\0')) {
+					device->imei = g_strdup(parameter);
+				} else {
+					device->imei = NULL;
+				}
 				g_variant_unref(data);
 			} else {
 				device->imei = NULL;
@@ -1546,7 +1555,12 @@
 		data = mmgui_module_proxy_get_property(moduledata->netproxy, "Technology", G_VARIANT_TYPE_STRING);
 		if (data != NULL) {
 			strsize = 256;
-			device->mode = mmgui_module_access_mode_translate(g_variant_get_string(data, &strsize));
+			parameter = g_variant_get_string(data, &strsize);
+			if ((parameter != NULL) && (parameter[0] != '\0')) {
+				device->mode = mmgui_module_access_mode_translate(parameter);
+			} else {
+				device->mode = MMGUI_DEVICE_MODE_UNKNOWN;
+			}
 			g_variant_unref(data);
 		} else {
 			device->mode = MMGUI_DEVICE_MODE_UNKNOWN;
@@ -1555,7 +1569,12 @@
 		data = mmgui_module_proxy_get_property(moduledata->netproxy, "Status", G_VARIANT_TYPE_STRING);
 		if (data != NULL) {
 			strsize = 256;
-			device->regstatus = mmgui_module_registration_status_translate(g_variant_get_string(data, &strsize));
+			parameter = g_variant_get_string(data, &strsize);
+			if ((parameter != NULL) && (parameter[0] != '\0')) {
+				device->regstatus = mmgui_module_registration_status_translate(parameter);
+			} else {
+				device->regstatus = MMGUI_REG_STATUS_UNKNOWN;
+			}
 			g_variant_unref(data);
 		} else {
 			device->regstatus = MMGUI_REG_STATUS_UNKNOWN;
@@ -1564,7 +1583,12 @@
 		data = mmgui_module_proxy_get_property(moduledata->netproxy, "Name", G_VARIANT_TYPE_STRING);
 		if (data != NULL) {
 			strsize = 256;
-			device->operatorname = g_strdup(g_variant_get_string(data, &strsize));
+			parameter = g_variant_get_string(data, &strsize);
+			if ((parameter != NULL) && (parameter[0] != '\0')) {
+				device->operatorname = g_strdup(parameter);
+			} else {
+				device->operatorname = NULL;
+			}
 			g_variant_unref(data);
 		} else {
 			device->operatorname = NULL;
@@ -1573,28 +1597,33 @@
 		data = mmgui_module_proxy_get_property(moduledata->netproxy, "MobileCountryCode", G_VARIANT_TYPE_STRING);
 		if (data != NULL) {
 			strsize = 256;
-			device->loc3gppdata[0] = atoi(g_variant_get_string(data, &strsize));
-			device->operatorcode |= (device->loc3gppdata[0] & 0x0000ffff) << 16;
-			moduledata->location |= MODULE_INT_MODEM_LOCATION_MCC;
-			if (moduledata->location == MODULE_INT_MODEM_LOCATION_ALL) {
-				device->locationcaps |= MMGUI_LOCATION_CAPS_3GPP;
+			parameter = g_variant_get_string(data, &strsize);
+			if ((parameter != NULL) && (parameter[0] != '\0')) {
+				device->loc3gppdata[0] = atoi(parameter);
+				device->operatorcode |= (device->loc3gppdata[0] & 0x0000ffff) << 16;
+				moduledata->location |= MODULE_INT_MODEM_LOCATION_MCC;
+				if (moduledata->location == MODULE_INT_MODEM_LOCATION_ALL) {
+					device->locationcaps |= MMGUI_LOCATION_CAPS_3GPP;
+				}
 			}
 			g_variant_unref(data);
 		}
 		data = mmgui_module_proxy_get_property(moduledata->netproxy, "MobileNetworkCode", G_VARIANT_TYPE_STRING);
 		if (data != NULL) {
 			strsize = 256;
-			device->loc3gppdata[1] = atoi(g_variant_get_string(data, &strsize));
-			device->operatorcode |= device->loc3gppdata[1] & 0x0000ffff;
-			moduledata->location |= MODULE_INT_MODEM_LOCATION_MNC;
-			if (moduledata->location == MODULE_INT_MODEM_LOCATION_ALL) {
-				device->locationcaps |= MMGUI_LOCATION_CAPS_3GPP;
+			parameter = g_variant_get_string(data, &strsize);
+			if ((parameter != NULL) && (parameter[0] != '\0')) {
+				device->loc3gppdata[1] = atoi(parameter);
+				device->operatorcode |= device->loc3gppdata[1] & 0x0000ffff;
+				moduledata->location |= MODULE_INT_MODEM_LOCATION_MNC;
+				if (moduledata->location == MODULE_INT_MODEM_LOCATION_ALL) {
+					device->locationcaps |= MMGUI_LOCATION_CAPS_3GPP;
+				}
 			}
 			g_variant_unref(data);
 		}
 		data = mmgui_module_proxy_get_property(moduledata->netproxy, "LocationAreaCode", G_VARIANT_TYPE_UINT16);
 		if (data != NULL) {
-			strsize = 256;
 			device->loc3gppdata[2] = g_variant_get_uint16(data);
 			moduledata->location |= MODULE_INT_MODEM_LOCATION_LAC;
 			if (moduledata->location == MODULE_INT_MODEM_LOCATION_ALL) {
@@ -1604,7 +1633,6 @@
 		}
 		data = mmgui_module_proxy_get_property(moduledata->netproxy, "CellId", G_VARIANT_TYPE_UINT32);
 		if (data != NULL) {
-			strsize = 256;
 			device->loc3gppdata[3] = g_variant_get_uint32(data);
 			moduledata->location |= MODULE_INT_MODEM_LOCATION_CID;
 			if (moduledata->location == MODULE_INT_MODEM_LOCATION_ALL) {
@@ -1626,7 +1654,12 @@
 				data = mmgui_module_proxy_get_property(moduledata->cardproxy, "SubscriberIdentity", G_VARIANT_TYPE_STRING);
 				if (data != NULL) {
 					strsize = 256;
-					device->imsi = g_strdup(g_variant_get_string(data, &strsize));
+					parameter = g_variant_get_string(data, &strsize);
+					if ((parameter != NULL) && (parameter[0] != '\0')) {
+						device->imsi = g_strdup(parameter);
+					} else {
+						device->imsi = NULL;
+					}
 					g_variant_unref(data);
 				} else {
 					device->imsi = NULL;
@@ -1876,16 +1909,18 @@
 			g_variant_iter_init(&iterl1, interfaces);
 			while ((nodel1 = g_variant_iter_next_value(&iterl1)) != NULL) {
 				interface = g_variant_get_string(nodel1, &strsize);
-				if (g_str_equal(interface, "org.ofono.NetworkRegistration")) {
-					mmgui_module_open_network_registration_interface(mmguicore, device);
-				} else if (g_str_equal(interface, "org.ofono.SimManager")) {
-					mmgui_module_open_sim_manager_interface(mmguicore, device);
-				} else if (g_str_equal(interface, "org.ofono.MessageManager")) {
-					mmgui_module_open_message_manager_interface(mmguicore, device);
-				} else if (g_str_equal(interface, "org.ofono.SupplementaryServices")) {
-					mmgui_module_open_supplementary_services_interface(mmguicore, device);
-				} else if (g_str_equal(interface, "org.ofono.Phonebook")) {
-					mmgui_module_open_phonebook_interface(mmguicore, device);
+				if ((interface != NULL) && (interface[0] != '\0')) {
+					if (g_str_equal(interface, "org.ofono.NetworkRegistration")) {
+						mmgui_module_open_network_registration_interface(mmguicore, device);
+					} else if (g_str_equal(interface, "org.ofono.SimManager")) {
+						mmgui_module_open_sim_manager_interface(mmguicore, device);
+					} else if (g_str_equal(interface, "org.ofono.MessageManager")) {
+						mmgui_module_open_message_manager_interface(mmguicore, device);
+					} else if (g_str_equal(interface, "org.ofono.SupplementaryServices")) {
+						mmgui_module_open_supplementary_services_interface(mmguicore, device);
+					} else if (g_str_equal(interface, "org.ofono.Phonebook")) {
+						mmgui_module_open_phonebook_interface(mmguicore, device);
+					}
 				}
 				g_variant_unref(nodel1);
 			}
@@ -2177,53 +2212,59 @@
 	/*Message text and parameters*/
 	smsmessagev = g_variant_get_child_value(smsdata, 0);
 	smsparamsv = g_variant_get_child_value(smsdata, 1);
-	if ((smsmessagev != NULL) || (smsparamsv != NULL)) {
-		message = mmgui_smsdb_message_create();
-		/*Message text*/
-		gottext = FALSE;
-		strlength = 160*256;
-		valuestr = g_variant_get_string(smsmessagev, &strlength);
-		if (valuestr != NULL) {
-			mmgui_smsdb_message_set_text(message, valuestr, FALSE);
-			gottext = TRUE;
-		}
-		g_variant_unref(smsmessagev);
-		/*Message sender*/
-		value = g_variant_lookup_value(smsparamsv, "Sender", G_VARIANT_TYPE_STRING);
-		if (value != NULL) {
-			strlength = 256;
-			valuestr = g_strdup(g_variant_get_string(value, &strlength));
+	
+	if ((smsmessagev == NULL) || (smsparamsv == NULL)) return NULL;
+		
+	message = mmgui_smsdb_message_create();
+	
+	/*Message text*/
+	gottext = FALSE;
+	strlength = 160*256;
+	valuestr = g_variant_get_string(smsmessagev, &strlength);
+	if ((valuestr != NULL) && (valuestr[0] != '\0')) {
+		mmgui_smsdb_message_set_text(message, valuestr, FALSE);
+		gottext = TRUE;
+	}
+	g_variant_unref(smsmessagev);
+		
+	/*Message has no text - skip it*/
+	if (!gottext) {
+		mmgui_smsdb_message_free(message);
+		return NULL;
+	}
+		
+	/*Message sender*/
+	value = g_variant_lookup_value(smsparamsv, "Sender", G_VARIANT_TYPE_STRING);
+	if (value != NULL) {
+		strlength = 256;
+		valuestr = g_variant_get_string(value, &strlength);
+		if ((valuestr != NULL) && (valuestr[0] != '\0')) {
 			mmgui_smsdb_message_set_number(message, valuestr);
 			g_debug("SMS number: %s\n", valuestr);
-			g_variant_unref(value);
 		} else {
 			mmgui_smsdb_message_set_number(message, _("Unknown"));
 		}
-		/*Message local time*/
-		value = g_variant_lookup_value(smsparamsv, "LocalSentTime", G_VARIANT_TYPE_STRING);
-		if (value != NULL) {
-			strlength = 256;
-			valuestr = g_variant_get_string(value, &strlength);
+		g_variant_unref(value);
+	} else {
+		mmgui_smsdb_message_set_number(message, _("Unknown"));
+	}
+	
+	/*Message local time*/
+	value = g_variant_lookup_value(smsparamsv, "LocalSentTime", G_VARIANT_TYPE_STRING);
+	if (value != NULL) {
+		strlength = 256;
+		valuestr = g_variant_get_string(value, &strlength);
+		if ((valuestr != NULL) && (valuestr[0] != '\0')) {
 			mmgui_smsdb_message_set_timestamp(message, mmgui_module_str_to_time(valuestr));
-			g_debug("SMS local timestamp: %lu\n", (gulong)message->timestamp);
-			g_variant_unref(value);
-		} else {
-			mmgui_smsdb_message_set_timestamp(message, (gulong)time(NULL));
-		}
-		/*Return message*/
-		if (!gottext) {
-			/*Message has no text - skip it*/
-			mmgui_smsdb_message_free(message);
-			return NULL;
-		} else {
-			/*Return message*/
-			mmgui_smsdb_message_set_identifier(message, 0, FALSE);
-			//g_debug("SMS index: %u\n", index);
-			return message;
+			g_debug("SMS timestamp: %s", ctime((const time_t *)&message->timestamp));
 		}
+		g_variant_unref(value);
 	}
-		
-	return NULL;
+	
+	/*Message index (0 since oFono automatically removes messages from modem memory)*/
+	mmgui_smsdb_message_set_identifier(message, 0, FALSE);
+	
+	return message;
 }
 
 G_MODULE_EXPORT guint mmgui_module_sms_enum(gpointer mmguicore, GSList **smslist)
@@ -2375,7 +2416,7 @@
 						if (smsstatev != NULL) {
 							smsstatesize = 256;
 							smsstate = g_variant_get_string(smsstatev, &smsstatesize);
-							if (smsstate != NULL) {
+							if ((smsstate != NULL) && (smsstate[0] != '\0')) {
 								/*Message must be already sent or pending*/
 								if ((g_str_equal(smsstate, "pending")) || (g_str_equal(smsstate, "sent"))) {
 									sent = TRUE;					
@@ -2523,7 +2564,7 @@
 	strsize = 256;
 	state = (gchar *)g_variant_get_string(session, &strsize);
 	
-	if (state != NULL) {
+	if ((state != NULL) && (state[0] != '\0')) {
 		if (g_str_equal(state, "idle")) {
 			stateid = MMGUI_USSD_STATE_IDLE;
 		} else if (g_str_equal(state, "active")) {
@@ -2545,6 +2586,7 @@
 	GError *error;
 	GVariant *result;
 	const gchar *restype;
+	const gchar *parameter;
 	gchar *reqtype, *answer;
 	gsize strsize;
 	GVariant *data;
@@ -2574,13 +2616,17 @@
 			g_variant_get(result, "(sv)", &reqtype, &data);
 			if (g_str_equal(reqtype, "USSD")) {
 				strsize = 4096;
-				answer = g_strdup(g_variant_get_string(data, &strsize));
+				parameter = g_variant_get_string(data, &strsize);
+				if ((parameter != NULL) && (parameter[0] != '\0')) {
+					answer = g_strdup(parameter);
+				} else {
+					answer = NULL;
+				}
 			}
 			g_variant_unref(data);
 		} else if (g_str_equal(restype, "(s)")) {
 			/*Response*/
 			g_variant_get(result, "(s)", &answer);
-			answer = g_strdup(answer);
 		}
 		g_variant_unref(result);
 	}
@@ -2661,9 +2707,9 @@
 	mmgui_scanned_network_t network;
 	gsize technologies;
 	GVariant *dict, *techs, *value;
-	gchar opcode[6];
 	gsize strlength;
 	guint i;
+	const gchar *parameter;
 		
 	if ((networkv == NULL) || (networks == NULL)) return 0;
 	
@@ -2675,53 +2721,73 @@
 	} else {
 		technologies = 0;
 	}
-	
+		
 	if (technologies > 0) {
 		for (i=0; i<technologies; i++) {
 			network = g_new0(struct _mmgui_scanned_network, 1);
-			//Mobile operator code (MCCMNC)
-			memset(opcode, 0, sizeof(opcode));
+			/*Mobile operator code (MCCMNC)*/
+			network->operator_num = 0;
 			value = g_variant_lookup_value(dict, "MobileCountryCode", G_VARIANT_TYPE_STRING);
 			if (value != NULL) {
 				strlength = 256;
-				strncpy(opcode, g_variant_get_string(value, &strlength), 3);
+				parameter = g_variant_get_string(value, &strlength);
+				if ((parameter != NULL) && (parameter[0] != '\0')) {
+					network->operator_num |= (atoi(parameter) & 0x0000ffff) << 16;
+				}
 				g_variant_unref(value);
 			}
 			value = g_variant_lookup_value(dict, "MobileNetworkCode", G_VARIANT_TYPE_STRING);
 			if (value != NULL) {
 				strlength = 256;
-				strncpy(opcode+3, g_variant_get_string(value, &strlength), 2);
+				parameter = g_variant_get_string(value, &strlength);
+				if ((parameter != NULL) && (parameter[0] != '\0')) {
+					network->operator_num |= atoi(parameter) & 0x0000ffff;
+				}
 				g_variant_unref(value);
 			}
-			network->operator_num = atoi(opcode);
-			//Network access technology
+			/*Network access technology*/
 			value = g_variant_get_child_value(techs, i);
 			if (value != NULL) {
 				strlength = 256;
-				network->access_tech = mmgui_module_access_technology_translate(g_variant_get_string(value, &strlength));
+				parameter = g_variant_get_string(value, &strlength);
+				if ((parameter != NULL) && (parameter[0] != '\0')) {
+					network->access_tech = mmgui_module_access_technology_translate(parameter);
+				} else {
+					network->access_tech = MMGUI_ACCESS_TECH_GSM;
+				}
 				g_variant_unref(value);
 			} else {
 				network->access_tech = MMGUI_ACCESS_TECH_GSM;
 			}
-			//Long-format name of operator
+			/*Name of operator*/
 			value = g_variant_lookup_value(dict, "Name", G_VARIANT_TYPE_STRING);
 			if (value != NULL) {
 				strlength = 256;
-				network->operator_long = g_strdup(g_variant_get_string(value, &strlength));
-				//Short-format name of operator
-				strlength = 256;
-				network->operator_short = g_strdup(g_variant_get_string(value, &strlength));
+				parameter = g_variant_get_string(value, &strlength);
+				if ((parameter != NULL) && (parameter[0] != '\0')) {
+					network->operator_long = g_strdup(parameter);
+					network->operator_short = g_strdup(parameter);
+				} else {
+					network->operator_long = g_strdup(_("Unknown"));
+					network->operator_short = g_strdup(_("Unknown"));
+				}
 				g_variant_unref(value);
 			} else {
 				network->operator_long = g_strdup(_("Unknown"));
+				network->operator_short = g_strdup(_("Unknown"));
 			}
-			//Network availability status
+			/*Network availability status*/
 			value = g_variant_lookup_value(dict, "Status", G_VARIANT_TYPE_STRING);
 			if (value != NULL) {
 				strlength = 256;
-				network->status = mmgui_module_network_availability_status_translate(g_variant_get_string(value, &strlength));
+				parameter = g_variant_get_string(value, &strlength);
+				if ((parameter != NULL) && (parameter[0] != '\0')) {
+					network->status = mmgui_module_network_availability_status_translate(parameter);
+				} else {
+					network->status = MMGUI_NA_UNKNOWN;
+				}
 				g_variant_unref(value);
-				//Add network to list
+				/*Add network to list*/
 				*networks = g_slist_prepend(*networks, network);
 				return 1;
 			} else {
@@ -2863,8 +2929,10 @@
 		/*Convert to string*/
 		vcardstrlen = 16384;
 		vcardstr = g_variant_get_string(contpayload, &vcardstrlen);
-		/*Enumerate contacts*/
-		contactsnum = vcard_parse_string(vcardstr, contactslist, "SIM");
+		if ((vcardstr != NULL) && (vcardstr[0] != '\0')) {
+			/*Enumerate contacts*/
+			contactsnum = vcard_parse_string(vcardstr, contactslist, "SIM");
+		}
 		/*Free resources*/
 		g_variant_unref(contpayload);
 	}