Changeset 3453
- Timestamp:
- 11/20/07 15:00:44 (6 years ago)
- Location:
- trunk/src/target/OM-2007.2/applications/openmoko-dialer2
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
src/phone-kit/moko-dialer-sms.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
r3452 r3453 1 2007-11-20 Chris Lord <chris@openedhand.com> 2 3 * src/phone-kit/moko-dialer-sms.c: (moko_dialer_sms_finalize), 4 (store_sms), (gsmd_eventhandler), (sms_msghandler), 5 (net_msghandler), (opened_cb), (moko_dialer_sms_send): 6 Add more debugging, get own phone number correctly 7 1 8 2007-11-19 Chris Lord <chris@openedhand.com> 2 9 -
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer-sms.c
r3452 r3453 32 32 JanaNote *last_msg; 33 33 MokoDialerSMSSource *source; 34 gchar *own_number; 34 35 }; 35 36 … … 67 68 68 69 g_source_destroy ((GSource *)priv->source); 70 g_free (priv->own_number); 69 71 lgsm_exit (priv->handle); 70 72 … … 133 135 switch (sms->payload.coding_scheme) { 134 136 case ALPHABET_DEFAULT : 135 message = g_malloc (GSMD_SMS_DATA_MAXLEN); 137 g_debug ("Decoding 7-bit ASCII message"); 138 message = g_malloc0 (GSMD_SMS_DATA_MAXLEN); 136 139 unpacking_7bit_character ( 137 140 &sms->payload, message); … … 139 142 case ALPHABET_8BIT : 140 143 /* TODO: Verify: Is this encoding just UTF-8? */ 144 g_debug ("Decoding UTF-8 message"); 141 145 message = g_strdup (sms->payload.data); 142 146 break; 143 147 case ALPHABET_UCS2 : 148 g_debug ("Decoding UCS-2 message"); 144 149 message = g_utf16_to_utf8 ((const gunichar2 *) 145 150 sms->payload.data, sms->payload.length, … … 163 168 g_free (author); 164 169 165 /* TODO: Normalise number necessary? */ 166 recipient = g_strdup_printf ("%d", 167 lgsm_get_subscriber_num (priv->handle)); 168 jana_note_set_recipient (note, recipient); 169 g_free (recipient); 170 jana_note_set_recipient (note, priv->own_number); 170 171 171 172 jana_note_set_body (note, message); … … 202 203 struct gsmd_sms_list * sms = 203 204 (struct gsmd_sms_list *)aux->data; 205 g_debug ("Message inline"); 204 206 store_sms (moko_dialer_sms_get_default (), sms); 205 207 } else { 208 g_debug ("Message stored on SIM, reading..."); 206 209 lgsm_sms_read (priv->handle, aux->u.sms.index); 207 210 } … … 278 281 g_debug ("Storing message on SIM"); 279 282 store_sms (sms, sms_list); 280 } 283 } else { 284 return -EINVAL; 285 } 286 287 return 0; 288 } 289 290 static int 291 net_msghandler (struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) 292 { 293 MokoDialerSMS *sms = moko_dialer_sms_get_default (); 294 MokoDialerSMSPrivate *priv = SMS_PRIVATE (sms); 295 296 const struct gsmd_own_number *num = (struct gsmd_own_number *) 297 ((void *) gmh + sizeof(*gmh)); 298 299 if (gmh->msg_subtype != GSMD_NETWORK_GET_NUMBER) return -EINVAL; 300 301 g_free (priv->own_number); 302 303 /* TODO: Normalise number necessary? */ 304 priv->own_number = g_strdup (num->addr.number); 305 g_debug ("Got phone number: %s", priv->own_number); 281 306 282 307 return 0; … … 346 371 lgsm_register_handler (priv->handle, GSMD_MSG_SMS, &sms_msghandler); 347 372 348 /* List all messages to move to journal*/349 lgsm_ sms_list (priv->handle, GSMD_SMS_ALL);373 /* Connect network message handler (to get phone number) */ 374 lgsm_register_handler (priv->handle, GSMD_MSG_NETWORK, &net_msghandler); 350 375 351 376 /* Start polling for events */ … … 358 383 g_source_add_poll ((GSource*)priv->source, &priv->source->pollfd); 359 384 g_source_attach ((GSource*)priv->source, NULL); 385 386 /* Get phone number */ 387 lgsm_get_subscriber_num (priv->handle); 388 389 /* List all messages to move to journal */ 390 lgsm_sms_list (priv->handle, GSMD_SMS_ALL); 360 391 } 361 392 … … 457 488 note = jana_ecal_note_new (); 458 489 jana_note_set_recipient (note, number); 459 460 /* TODO: Normalise number necessary? */ 461 author = g_strdup_printf ("%d", 462 lgsm_get_subscriber_num (priv->handle)); 463 jana_note_set_author (note, author); 464 g_free (author); 490 jana_note_set_author (note, priv->own_number); 465 491 466 492 jana_note_set_body (note, message);
Note: See TracChangeset
for help on using the changeset viewer.
