[Xfce4-commits] <xfce4-cellmodem-plugin:master> Fix SMS import

Alvaro Lopes noreply at xfce.org
Tue Oct 13 21:28:03 CEST 2009


Updating branch refs/heads/master
         to 54f2a37b8e757c4d3912b3a836b7740167c67b04 (commit)
       from dab2591457a582657de98b1f415f4a4f58d497c7 (commit)

commit 54f2a37b8e757c4d3912b3a836b7740167c67b04
Author: Alvaro Lopes <alvieboy at alvie.com>
Date:   Mon Oct 12 09:58:56 2009 +0100

    Fix SMS import

 configure.ac.in                             |   15 +-
 panel-plugin/Makefile.am                    |    6 -
 panel-plugin/cellmodem.c                    |   39 +--
 panel-plugin/sms.c                          |  501 +++++++++++++++++++++++++++
 panel-plugin/{cellmodem_options.h => sms.h} |   46 ++-
 panel-plugin/sms_dialog.c                   |  318 +++++++++++++++++
 panel-plugin/{leds.h => sms_dialog.h}       |   50 ++--
 panel-plugin/sms_tables.c                   |  223 ++++++++++++
 panel-plugin/{pin_helper.h => sms_tables.h} |   31 +-
 9 files changed, 1131 insertions(+), 98 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index afa8852..764c48e 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -34,13 +34,18 @@ else
 fi
 
 AC_ARG_ENABLE([sms],
-[  --enable-sms   	  Enable SMS support],
-AC_DEFINE(HAVE_SMS_SUPPORT,[1],[Enable SMS support])
-AM_CONDITIONAL(HAVE_SMS_SUPPORT,true),
-AM_CONDITIONAL(HAVE_SMS_SUPPORT,false)
-
+[  --disable-sms   	  Disable SMS support],
+[use_sms=$enableval],[use_sms=yes]
 )
 
+if test $use_sms = yes; then
+	AC_DEFINE(HAVE_SMS_SUPPORT,[1],[Enable SMS support])
+	AM_CONDITIONAL(HAVE_SMS_SUPPORT,true)
+else
+	AM_CONDITIONAL(HAVE_SMS_SUPPORT,false)
+fi
+
+
 # PCI library needs libz.
 
 AC_CHECK_HEADER([zlib.h],
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index e4753d9..0f32d41 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -2,12 +2,6 @@ plugindir = $(libexecdir)/xfce4/panel-plugins
 
 plugin_PROGRAMS = xfce4-cellmodem-plugin
 
-if HAVE_SMS_SUPPORT
-
-noinst_PROGRAMS=test-sms
-
-endif
-
 xfce4_cellmodem_plugin_CFLAGS = \
         -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
 	@LIBXFCE4PANEL_CFLAGS@
diff --git a/panel-plugin/cellmodem.c b/panel-plugin/cellmodem.c
index e25c160..99ebad5 100644
--- a/panel-plugin/cellmodem.c
+++ b/panel-plugin/cellmodem.c
@@ -61,8 +61,7 @@ static void cellmodem_t_get_cpms (cellmodem_t * monitor);
 #endif
  /*FOLD00 */
 static void cellmodem_t_get_pin_status (cellmodem_t * monitor);
-static void cellmodem_t_send_pin (cellmodem_t * monitor, const gchar * pin,
-				  gboolean save);
+static void cellmodem_t_send_pin (cellmodem_t * monitor, const gchar * pin);
 static void cellmodem_t_set_tooltip_info (cellmodem_t * monitor);
 static void cellmodem_t_get_ohcip_status (cellmodem_t * monitor);
 static gboolean cellmodem_button_event (GtkEventBox * box,
@@ -778,24 +777,11 @@ cellmodem_t_close_modem (cellmodem_t * monitor /*, gboolean failure */ )
 }
 
 static void
-pin_callback (const gchar * pin, gboolean save, void *pvt)
+pin_callback (const gchar * pin, void *pvt)
 {
   cellmodem_t *monitor = (cellmodem_t *) pvt;
 
-  if (NULL != monitor->request_save_pin)
-    g_free (monitor->request_save_pin);
-
-  if (save)
-    {
-      monitor->request_save_pin = g_strdup (pin);
-    }
-  else
-    {
-      monitor->request_save_pin = NULL;
-    }
-
-
-  cellmodem_t_send_pin (monitor, pin, save);
+  cellmodem_t_send_pin (monitor, pin);
 }
 
 static void
@@ -813,10 +799,12 @@ cellmodem_t_request_pin (cellmodem_t * monitor)
   else
     {
       /* Try sending the saved PIN. */
-      if (monitor->request_save_pin != NULL)
+      /*
+       if (monitor->request_save_pin != NULL)
 	{
-	  pin_callback (monitor->request_save_pin, TRUE, monitor);
-	}
+	  pin_callback (monitor->request_save_pin, monitor);
+	  }
+	  */
     }
 }
 
@@ -1873,7 +1861,7 @@ cellmodem_t_set_cmgf (cellmodem_t * monitor)
 #endif
 
 static void
-cellmodem_t_send_pin (cellmodem_t * monitor, const gchar * pin, gboolean save)
+cellmodem_t_send_pin (cellmodem_t * monitor, const gchar * pin)
 {
   GString *g = g_string_new ("+CPIN=");
   g_string_append (g, pin);
@@ -1886,15 +1874,6 @@ cellmodem_t_send_pin (cellmodem_t * monitor, const gchar * pin, gboolean save)
 				   g->str, NULL);
       g_string_free (g, TRUE);
 
-      if (NULL != monitor->request_save_pin)
-	g_free (monitor->request_save_pin);
-      monitor->request_save_pin = NULL;
-
-      if (save)
-	{
-	  monitor->request_save_pin = g_strdup (pin);
-	}
-
       cellmodem_t_switch_status (monitor, MODEM_WAIT_PINE_RESPONSE);
     }
   else
diff --git a/panel-plugin/sms.c b/panel-plugin/sms.c
new file mode 100644
index 0000000..72d8e3c
--- /dev/null
+++ b/panel-plugin/sms.c
@@ -0,0 +1,501 @@
+/*
+ * Copyright (c) 2007 Alvaro Lopes <alvieboy at alvie.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "sms.h"
+
+#ifdef HAVE_SMS_SUPPORT
+
+#include <string.h>
+#include <stdio.h>
+#include "sms_tables.h"
+#include <netinet/in.h>
+
+#ifdef CORE_SMS_DEBUG
+#define SMSDEBUG(x...) fprintf(stderr,x)
+#else
+#define SMSDEBUG(x...)		/* */
+#endif
+
+/* Unsafe. But we have checked vality of the chars before */
+
+static unsigned char
+hexnibble (unsigned char c)
+{
+  unsigned char n = c - '0';
+  if (n > 9)
+    {
+      n -= ('A' - '0' - 10);
+    }
+  return n;
+}
+
+
+#define NIBBLESWAP(x) ( ( (x)>>4 ) | ((x)<<4) )
+
+
+static void
+fix_ucs2_byteorder (gushort * start, gsize count)
+{
+  while (count--)
+    {
+      *start = ntohs (*start);
+      start++;
+    }
+}
+
+gchar *
+convert_binary_to_decimal_swapped (const guchar * binary, size_t length)
+{
+  gchar *r = g_malloc (length + 1);
+  gchar *rptr = r;
+
+  while (length)
+    {
+      guchar thischar = NIBBLESWAP (*binary);
+      if (length > 1)
+	{
+	  rptr += sprintf (rptr, "%02X", thischar);
+	  length -= 2;
+	  binary++;
+	}
+      else
+	{
+	  /* We have an 'F'. */
+	  rptr += sprintf (rptr, "%1X", (thischar >> 4));
+	  length--;
+	}
+    }
+  *rptr = '\0';
+  return r;
+}
+
+
+static inline guchar
+bcd2decimal_swapped (guchar bcd)
+{
+  bcd = NIBBLESWAP (bcd);
+  return (((bcd) >> 4) * 10 + ((bcd) & 0xf));
+}
+
+static time_t
+parse_timestamp (const guchar * binary)
+{
+  struct tm tm_ts;
+  struct tm tm_now;		/* To figure out the year */
+  gint tz_offset;
+
+  time_t now = time (NULL);
+
+  (void) localtime_r (&now, &tm_now);
+
+  guint start_of_century = (tm_now.tm_year / 100) * 100;
+  guint year = bcd2decimal_swapped (*binary);
+
+  tm_ts.tm_year = start_of_century + year;
+
+  if (tm_ts.tm_year > tm_now.tm_year)
+    {
+      /* Is future */
+      tm_ts.tm_year -= 100;
+    }
+
+  binary++;
+
+  tm_ts.tm_mon = bcd2decimal_swapped (*binary) - 1;
+  binary++;
+  tm_ts.tm_mday = bcd2decimal_swapped (*binary);
+  binary++;
+  tm_ts.tm_hour = bcd2decimal_swapped (*binary);
+  binary++;
+  tm_ts.tm_min = bcd2decimal_swapped (*binary);
+  binary++;
+  tm_ts.tm_sec = bcd2decimal_swapped (*binary);
+  binary++;
+  tz_offset = bcd2decimal_swapped (*binary);
+  binary++;
+
+  if (tz_offset & 0x80)
+    {
+      tz_offset &= 0x7F;
+      tz_offset *= -1;
+    }
+
+  tm_ts.tm_gmtoff = tz_offset * 15 * 60;	/* Each is 15 minutes */
+
+  return mktime (&tm_ts);
+}
+
+static void
+append_utf8 (GString * str, gushort utf)
+{
+  if (utf < 0x80)
+    {
+      g_string_append_c (str, utf & 0x7F);
+    }
+  else
+    {
+/*		SMSDEBUG("UTF %04X\n",utf);
+        guchar wutf = utf>>8;
+		g_string_append_len(str, (gchar*)&wutf, 1);
+        wutf = utf&0xff;
+		g_string_append_len(str, (gchar*)&wutf, 1 );*/
+      g_string_append_unichar (str, utf);
+    }
+}
+
+static void
+append_7bit_alphabet (GString * str, guchar alpha, sms_7bit_state_t * state)
+{
+  unsigned short utf;
+
+  switch (*state)
+    {
+
+    case STATE_ALPHABET_NORMAL:
+      //SMSDEBUG(" 0x%02X ", alpha);
+      if (SMS_ESCAPE_CHARACTER == alpha)
+	{
+	  //   SMSDEBUG("Entering SMS extended\n");
+	  *state = STATE_ALPHABET_EXTENDED;
+
+	}
+      else
+	{
+	  append_utf8 (str, sms_7bit_to_utf8_table[alpha]);
+	}
+      break;
+    case STATE_ALPHABET_EXTENDED:
+      // SMSDEBUG("SMS extended: 0x%02x\n", alpha);
+      if (alpha >= SMS_EXTENDED_TABLE_SIZE)
+	{
+	  utf = 0x0000;
+	}
+      else
+	{
+	  utf = sms_7bit_to_utf8_table_ext[alpha];
+	}
+
+      if (0x0000 == utf)
+	{
+
+	  /* Fall back to standard table */
+
+	  if (SMS_ESCAPE_CHARACTER == alpha)
+	    {
+	      /* Invalid - use a space */
+	      utf = 0x0032;
+	    }
+	  else
+	    {
+	      utf = sms_7bit_to_utf8_table[alpha];
+	    }
+	}
+      append_utf8 (str, utf);
+      *state = STATE_ALPHABET_NORMAL;
+    default:
+      break;
+    }
+}
+
+GString *
+convert_7bit_to_utf8 (const guchar * binary, size_t length)
+{
+  /* optimize */
+  //gchar *out = g_malloc( length );
+  GString *out = g_string_sized_new (length);
+
+  gushort value = 0;
+  guint carrybits = 0;
+  gushort bv;
+  sms_7bit_state_t state = STATE_ALPHABET_NORMAL;
+
+  while (length > 0)
+    {
+      bv = *binary;
+      bv <<= carrybits;
+      value |= bv;
+      // *outptr = value&0x7F;
+
+      append_7bit_alphabet (out, value & 0x7F, &state);
+
+      value >>= 7;		/* Remove the 7 bits */
+      carrybits++;
+      if (carrybits > 6 && length > 1)
+	{
+
+	  append_7bit_alphabet (out, value & 0x7F, &state);
+	  length--;
+	  value = 0;
+	  carrybits = 0;
+	}
+
+      if (length > 0)
+	length--;
+
+      binary++;
+    }
+
+  return out;
+}
+
+
+static GString *
+sms_parse_address (const guchar * binary, size_t length)
+{
+  if (length < 1)
+    return NULL;
+
+  /* Length is the real length */
+
+  guchar format = *binary;
+  format >>= 4;
+  format &= 0x7;
+
+  SMSDEBUG ("format is %02x\n", format);
+  SMSDEBUG ("length is %02x\n", length);
+  binary++;
+
+  GString *text;
+
+  if (format == 5)
+    {
+      text = convert_7bit_to_utf8 (binary, length / 2);
+      g_string_append_c (text, '\0');
+    }
+  else
+    text = g_string_new (convert_binary_to_decimal_swapped (binary, length));
+
+  return text;
+}
+
+
+sms_entry_t *
+sms_create_from_pdu_line (const char *line)
+{
+  /* We will need to be charset aware */
+  guchar current_val;
+  guint pdulen = strlen (line) >> 1;
+  guchar *binpdu = g_malloc (pdulen);
+  guchar *pduptr = binpdu;
+  sms_entry_t *this_sms;
+  const gchar *lptr = line;
+
+  this_sms = g_new0 (sms_entry_t, 1);
+
+  while (*lptr)
+    {
+      current_val = hexnibble (*lptr) << 4;
+      lptr++;
+      current_val += hexnibble (*lptr);
+      lptr++;
+      *pduptr = current_val;
+      pduptr++;
+    }
+
+  // Now, handle PDU
+  pduptr = binpdu;
+  guchar *p_smsc_length = pduptr;
+
+#define PDU_REMOVE( s ) \
+	do { \
+	pduptr+=(s);  \
+	pdulen-=(s); \
+	} while (0);
+
+  PDU_REMOVE (1);
+
+  // Skip smsc. we don't need it
+  // Just do some sanity checks.
+
+  if (*p_smsc_length >= pdulen)
+    {
+      g_free (this_sms);
+      return NULL;
+    }
+  PDU_REMOVE (*p_smsc_length);
+
+  guchar sms_deliver_header = *pduptr;
+
+  PDU_REMOVE (1);
+
+  /* Check flags on PDU */
+
+  if (SMS_DELIVER_TP_MTI (sms_deliver_header) != 0)
+    {
+      // Maybe skip others ???
+      return this_sms;
+    }
+
+  if (SMS_DELIVER_TP_UHDI (sms_deliver_header))
+    {
+      /* No support for user header */
+      return this_sms;
+    }
+
+  /* Get sender */
+
+  guchar sender_address_length = *pduptr;
+  PDU_REMOVE (1);
+
+  if (sender_address_length > pdulen)
+    {
+      g_free (this_sms);
+      return NULL;
+    }
+
+  /* Parse sender address */
+
+  this_sms->sender = sms_parse_address (pduptr, sender_address_length);
+
+
+  guint real_sender_address_length =
+    1 + (sender_address_length / 2) + (sender_address_length % 2);
+  PDU_REMOVE (real_sender_address_length);
+
+  if (pdulen < 9)
+    {
+      g_free (this_sms);
+      return NULL;
+    }
+
+  //guint sms_pid = *pduptr; /* Protocol ID */
+  PDU_REMOVE (1);
+
+  guint sms_dcs = *pduptr;	/* Data Coding Scheme */
+  PDU_REMOVE (1);
+
+  this_sms->timestamp = parse_timestamp (pduptr);
+
+  this_sms->stamp_text = g_strdup (ctime (&this_sms->timestamp));
+
+  gchar *nl = strchr (this_sms->stamp_text, '\n');
+  if (nl)
+    {
+      *nl = '\0';
+    }
+
+  PDU_REMOVE (7);
+
+  /* Now, we don't know about other protocols but 0 */
+  /* See http://www.dreamfabric.com/sms/pid.html for more details */
+
+  // fprintf(stderr, "PID: %02X\n", sms_pid);
+
+  /*
+     if (sms_pid != 0) {
+     return this_sms;
+     }
+   */
+  /* Now, handle DCS. */
+
+
+  SMSDEBUG ("DCS: %02X\n", sms_dcs);
+  if ((sms_dcs & 0xC0) != 0)
+    {
+      return this_sms;
+    }
+
+  /* Skip compressed */
+
+  if ((sms_dcs & 0x20) != 0)
+    {
+      return this_sms;
+    }
+
+  guchar encoding_type = (sms_dcs >> 2) & 0x3;
+
+  /*
+     Encodings:
+     0 - default
+     1 - 8 bit
+     2 - UCS-2
+     3 - reserved
+   */
+
+  // Use the translation table to convert 7 bit to UTF-8.
+
+  guint text_size = *pduptr;
+  PDU_REMOVE (1);
+
+  /* TODO: Check PDU size */
+
+  SMSDEBUG ("PDU: %u\n", text_size);
+
+  switch (encoding_type)
+    {
+    case 0:
+      this_sms->text = convert_7bit_to_utf8 (pduptr, text_size);
+      break;
+    case 1:
+      {
+	gsize r_converted;
+	gsize w_converted;
+	GError *error = NULL;
+	gchar *t =
+	  g_convert ((gchar *) pduptr, text_size, "UTF-8", "ISO-8859-1",
+		     &r_converted, &w_converted, &error);
+	if (NULL == t)
+	  return this_sms;
+	this_sms->text = g_string_new_len (t, w_converted);
+      }
+      break;
+    case 2:
+      {
+	gsize r_converted;
+	gsize w_converted;
+	GError *error = NULL;
+
+	fix_ucs2_byteorder ((gushort *) pduptr, text_size >> 1);
+
+	gchar *t = g_convert ((gchar *) pduptr, text_size, "UTF-8", "UCS-2",
+			      &r_converted, &w_converted, &error);
+	if (NULL == t)
+	  return this_sms;
+
+	SMSDEBUG ("Converted from UCS-2\n");
+	this_sms->text = g_string_new_len (t, w_converted);
+      }
+      break;
+    default:
+      return this_sms;
+    }
+
+
+  this_sms->displayable = TRUE;
+  return this_sms;
+}
+
+void
+sms_free_entry (sms_entry_t * sms)
+{
+  if (NULL == sms)
+    return;
+
+  if (sms->text)
+    g_string_free (sms->text, TRUE);
+
+  if (sms->sender)
+    g_string_free (sms->sender, TRUE);
+
+  if (sms->stamp_text)
+    g_free (sms->stamp_text);
+
+  g_free (sms);
+}
+
+#endif
diff --git a/panel-plugin/cellmodem_options.h b/panel-plugin/sms.h
similarity index 51%
copy from panel-plugin/cellmodem_options.h
copy to panel-plugin/sms.h
index 192ef34..64db743 100644
--- a/panel-plugin/cellmodem_options.h
+++ b/panel-plugin/sms.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Alvaro Lopes <alvieboy at alvie.com>
+ * Copyright (c) 2007 Alvaro Lopes <alvieboy at alvie.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,25 +16,39 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifndef __CELLMODEM_OPTIONS_H__
-#define __CELLMODEM_OPTIONS_H__
+#ifndef __SMS_H__
+#define __SMS_H__
+
+#include "config.h"
+
+#ifdef HAVE_SMS_SUPPORT
 
 #include <glib.h>
-#include <termios.h>
+#include <sys/time.h>
+
 
 typedef struct
 {
-  gboolean display_tooltip_info;
-  gchar *modem_device;
-  gchar *modem_driver;
-  gchar *ppp_peer;
-  /*    gboolean  ask_for_pin; */
-  gint low_threshold;
-  gint critical_threshold;
-  gint max_quality;
-  speed_t speed;
-  gboolean check_for_sms;
-  guint sms_check_interval;
-} cellmodem_options_t;
+  gboolean displayable;		/* Might have unknown fields */
+
+  GString *sender;		/* Sender */
+  time_t timestamp;		/* Timestamp, in current TZ */
+  gchar *stamp_text;		/* Textual timestamp */
+  GString *text;		/* SMS text */
+} sms_entry_t;
+
+
+#define SMS_DELIVER_TP_MTI(c)     ((c)&0x3)
+#define SMS_DELIVER_TP_MMS(c)     ((c)&0x4)
+#define SMS_DELIVER_TP_RP(c)      ((c)&0x8)
+#define SMS_DELIVER_TP_UHDI(c)    ((c)&0x10)
+#define SMS_DELIVER_TP_SRI(c)     ((c)&0x20)
+
+sms_entry_t *sms_create_from_pdu_line (const char *line);
+void sms_free_entry (sms_entry_t *);
+
+
+
+#endif
 
 #endif
diff --git a/panel-plugin/sms_dialog.c b/panel-plugin/sms_dialog.c
new file mode 100644
index 0000000..a9c9520
--- /dev/null
+++ b/panel-plugin/sms_dialog.c
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2007 Alvaro Lopes <alvieboy at alvie.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+
+#ifdef HAVE_SMS_SUPPORT
+
+#include "sms_dialog.h"
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include "sms.h"
+
+#ifndef BORDER
+#define BORDER 8
+#endif
+
+
+static void
+cb_close_display_dialog_button (GtkButton * button,
+				sms_display_dialog_t * dialog)
+{
+  gtk_widget_destroy (dialog->window);
+}
+
+static void
+open_sms (GtkWidget * parent, sms_dialog_t * dialog, sms_entry_t * entry)
+{
+  sms_display_dialog_t *me = g_new0 (sms_display_dialog_t, 1);
+
+  GtkTextBuffer *buffer;
+
+  me->window = me->window = gtk_dialog_new_with_buttons (entry->sender->str,
+							 GTK_WINDOW
+							 (gtk_widget_get_toplevel
+							  (parent)),
+							 GTK_DIALOG_MODAL |
+							 GTK_DIALOG_DESTROY_WITH_PARENT,
+							 NULL);
+
+
+  me->textview = gtk_text_view_new ();
+
+  gtk_text_view_set_editable (GTK_TEXT_VIEW (me->textview), FALSE);
+  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (me->textview), GTK_WRAP_CHAR);
+
+  gtk_widget_set_size_request (me->window, 250, -1);
+
+  GtkWidget *hbox = gtk_hbox_new (FALSE, BORDER);
+
+  GtkWidget *label = gtk_label_new (_("From:"));
+  GtkWidget *sender = gtk_label_new (entry->sender->str);
+
+  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, BORDER);
+  gtk_box_pack_start (GTK_BOX (hbox), sender, FALSE, FALSE, BORDER);
+
+  gtk_widget_show (hbox);
+  gtk_widget_show (label);
+  gtk_widget_show (sender);
+
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (me->window)->vbox), hbox, FALSE,
+		      FALSE, BORDER);
+
+
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (me->window)->vbox), me->textview,
+		      TRUE, TRUE, BORDER);
+
+  gtk_widget_show (me->textview);
+
+  GtkWidget *button = gtk_button_new_with_label (_("Close"));
+
+  g_signal_connect (button, "clicked",
+		    G_CALLBACK (cb_close_display_dialog_button), me);
+  gtk_widget_show (button);
+
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (me->window)->action_area), button,
+		      FALSE, FALSE, BORDER);
+
+
+
+  PangoFontDescription *font;
+
+  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (me->textview));
+
+  if (entry->text)
+    gtk_text_buffer_set_text (buffer, entry->text->str, entry->text->len);
+  else
+    gtk_text_buffer_set_text (buffer, _("Unreadeable entry"), -1);
+
+  font = pango_font_description_from_string ("Monospace 10");
+
+  gtk_widget_modify_font (me->textview, font);
+  pango_font_description_free (font);
+
+  gtk_widget_show (me->window);
+}
+
+static void
+cb_read_message_button_clicked (GtkButton * button, sms_dialog_t * dialog)
+{
+  /* Find entry */
+  sms_entry_t *entry;
+  GtkTreeIter iter;
+  GValue gv = { 0, };
+
+  GtkTreeSelection *s =
+    gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->treeview));
+
+  if (NULL == s)
+    return;
+
+  gtk_tree_selection_get_selected (s, NULL, &iter);
+
+  if (!gtk_list_store_iter_is_valid (dialog->store, &iter))
+    return;
+
+
+  gtk_tree_model_get_value (GTK_TREE_MODEL (dialog->store), &iter, 2, &gv);
+
+  if (G_VALUE_HOLDS_POINTER (&gv))
+    {
+      entry = (sms_entry_t *) g_value_get_pointer (&gv);
+      open_sms (dialog->window, dialog, entry);
+    }
+}
+
+static void
+cb_fetch_new_button_clicked (GtkButton * button, sms_dialog_t * dialog)
+{
+}
+
+static void
+cb_close_button_clicked (GtkButton * button, sms_dialog_t * dialog)
+{
+  gtk_widget_destroy (dialog->window);
+}
+
+static void
+cb_destroy_window (GtkButton * button, sms_dialog_t * dialog)
+{
+  sms_dialog_t_free (dialog);
+}
+
+
+
+sms_dialog_t *
+sms_dialog_new (GtkWidget * parent)
+{
+  sms_dialog_t *me = g_new0 (sms_dialog_t, 1);
+
+  if (NULL == parent)
+    {
+      me->window = gtk_dialog_new ();
+    }
+  else
+    {
+      me->window = gtk_dialog_new_with_buttons (_("SMS List"),
+						GTK_WINDOW
+						(gtk_widget_get_toplevel
+						 (parent)),
+						GTK_DIALOG_MODAL |
+						GTK_DIALOG_DESTROY_WITH_PARENT,
+						NULL);
+    }
+  gtk_widget_set_size_request (me->window, 300, 200);
+
+  GtkWidget *scroll;
+
+  scroll = gtk_scrolled_window_new (NULL, NULL);
+
+  me->treeview = gtk_tree_view_new ();
+
+  gtk_tree_selection_set_mode (gtk_tree_view_get_selection
+			       (GTK_TREE_VIEW (me->treeview)),
+			       GTK_SELECTION_SINGLE);
+
+  me->store =
+    gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
+
+/*	me->statusbar = gtk_statusbar_new();*/
+
+  GtkWidget *vbox;
+
+  vbox = gtk_vbox_new (FALSE, 0);
+
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (me->window)->vbox), vbox, TRUE,
+		      TRUE, 0);
+
+  gtk_widget_show (vbox);
+
+  GtkWidget *label;
+
+  label = gtk_label_new (_("SMS List"));
+
+  gtk_widget_show (label);
+
+  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
+
+  gtk_container_add (GTK_CONTAINER (scroll), me->treeview);
+
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+  gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
+
+  gtk_widget_show (me->treeview);
+/*	gtk_widget_show(me->statusbar);*/
+  gtk_widget_show (scroll);
+
+  me->renderer = gtk_cell_renderer_text_new ();
+
+  me->columns[0] =
+    gtk_tree_view_column_new_with_attributes (_("Received"), me->renderer,
+					      "text", 0, NULL);
+
+  me->columns[1] =
+    gtk_tree_view_column_new_with_attributes (_("From"), me->renderer, "text",
+					      1, NULL);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (me->treeview), me->columns[0]);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (me->treeview), me->columns[1]);
+
+  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+
+
+  GtkWidget *hbox = gtk_hbox_new (FALSE, BORDER);
+  gtk_widget_show (hbox);
+
+  GtkWidget *button = gtk_button_new_with_label (_("Read message"));
+  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+
+  g_signal_connect (button, "clicked",
+		    G_CALLBACK (cb_read_message_button_clicked), me);
+
+  gtk_widget_show (button);
+
+  me->fetchbutton = gtk_button_new_with_label (_("Fetch new"));
+  gtk_box_pack_start (GTK_BOX (hbox), me->fetchbutton, TRUE, TRUE, 0);
+  gtk_widget_show (me->fetchbutton);
+  gtk_widget_set_sensitive (GTK_WIDGET (me->fetchbutton), FALSE);
+
+  g_signal_connect (button, "clicked",
+		    G_CALLBACK (cb_fetch_new_button_clicked), me);
+
+  button = gtk_button_new_with_label (_("Close"));
+  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
+  gtk_widget_show (button);
+
+  g_signal_connect (button, "clicked", G_CALLBACK (cb_close_button_clicked),
+		    me);
+
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (me->window)->action_area), hbox,
+		      FALSE, TRUE, 0);
+/*	gtk_box_pack_start( GTK_BOX(vbox), me->statusbar, FALSE, TRUE,0 );*/
+
+
+  g_signal_connect (me->window, "destroy", G_CALLBACK (cb_destroy_window),
+		    me);
+
+
+  me->list = NULL;
+  me->has_new = FALSE;
+
+  return me;
+}
+
+
+void
+sms_dialog_t_free (sms_dialog_t * dialog)
+{
+  g_object_unref (dialog->store);
+}
+
+void
+update_sms_entry (sms_entry_t * entry, sms_dialog_t * dialog)
+{
+  GtkTreeIter iter;
+  gtk_list_store_append (dialog->store, &iter);
+
+  gtk_list_store_set (dialog->store,
+		      &iter,
+		      0, entry->stamp_text,
+		      1, entry->sender->str, 2, entry, -1);
+
+  gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->treeview),
+			   GTK_TREE_MODEL (dialog->store));
+}
+
+void
+sms_dialog_t_update_list (sms_dialog_t * dialog, GList * entries,
+			  gboolean has_new)
+{
+  dialog->list = entries;
+  dialog->has_new = has_new;
+
+
+  gtk_widget_set_sensitive (GTK_WIDGET (dialog->fetchbutton),
+			    dialog->has_new);
+
+  gtk_list_store_clear (dialog->store);
+  g_list_foreach (entries, (GFunc) & update_sms_entry, dialog);
+}
+
+#endif
diff --git a/panel-plugin/leds.h b/panel-plugin/sms_dialog.h
similarity index 55%
copy from panel-plugin/leds.h
copy to panel-plugin/sms_dialog.h
index 0bc357a..964e66c 100644
--- a/panel-plugin/leds.h
+++ b/panel-plugin/sms_dialog.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Alvaro Lopes <alvieboy at alvie.com>
+ * Copyright (c) 2007 Alvaro Lopes <alvieboy at alvie.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,43 +16,39 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifndef __LEDS_H__
-#define __LEDS_H__
+#ifndef __SMSDIALOG_H__
+#define __SMSDIALOG_H__
 
 #include <gtk/gtk.h>
 
-typedef enum
-{
-  LED_OFF = 2,
-  LED_GREEN = 1,
-  LED_RED = 0,
-  LED_YELLOW = 3,
-  LED_BLUE = 4,
-} led_color_t;
-
-typedef enum
+typedef struct
 {
-  LED_NO_FLASH,
-  LED_FLASH_NORMAL,
-  LED_FLASH_FAST_TWICE
-} led_flash_type_t;
+
+  GtkWidget *window;
+  GtkWidget *treeview;
+  /*GtkWidget *statusbar; */
+  GtkWidget *fetchbutton;
+  GtkListStore *store;
+  GtkCellRenderer *renderer;
+  GtkTreeViewColumn *columns[2];
+  GList *list;
+  gboolean has_new;
+} sms_dialog_t;
+
 
 typedef struct
 {
-  GtkWidget *image;
-  led_flash_type_t flashing;
-  led_color_t color;
-  gboolean flash_on;
-} led_t;
+  GtkWidget *window;
+  GtkWidget *textview;
+} sms_display_dialog_t;
 
 
 
-led_t *led_t_new ();
-void led_t_set_color (led_t * led, led_color_t color);
-void led_t_set_flashing (led_t * led, led_flash_type_t flashing);
-void led_t_destroy (led_t * led);
-void led_t_flip_flash (led_t * led, gpointer data);
 
+sms_dialog_t *sms_dialog_new (GtkWidget * parent);
+void sms_dialog_t_free (sms_dialog_t * dialog);
+void sms_dialog_t_update_list (sms_dialog_t * dialog, GList * entries,
+			       gboolean has_new);
 
 
 #endif
diff --git a/panel-plugin/sms_tables.c b/panel-plugin/sms_tables.c
new file mode 100644
index 0000000..e5f7c94
--- /dev/null
+++ b/panel-plugin/sms_tables.c
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 2007 Alvaro Lopes <alvieboy at alvie.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "sms_tables.h"
+
+#ifdef HAVE_SMS_SUPPORT
+
+unsigned short sms_7bit_to_utf8_table[] = {
+  0x0040,			/* 0 - COMMERCIAL AT */
+  0x00A3,			/* 1 - POUND SIGN */
+  0x0024,			/* 2 - DOLLAR SIGN */
+  0x00A5,			/* 3 - YEN SIGN */
+  0x00E8,			/* 4 - LATIN SMALL LETTER E WITH GRAVE */
+  0x00E9,			/* 5 - LATIN SMALL LETTER E WITH ACUTE */
+  0x00F9,			/* 6 - LATIN SMALL LETTER U WITH GRAVE */
+  0x00EC,			/* 7 - LATIN SMALL LETTER I WITH GRAVE */
+  0x00F2,			/* 8 - LATIN SMALL LETTER O WITH GRAVE */
+  0x00C7,			/* 9 - LATIN CAPITAL LETTER C WITH CEDILLA */
+  0x000A,			/* 10 - LINE FEED */
+  0x00D8,			/* 11 - LATIN CAPITAL LETTER O WITH STROKE */
+  0x00F8,			/* 12 - LATIN SMALL LETTER O WITH STROKE */
+  0x000D,			/* 13 - CARRIAGE RETURN */
+  0x00C5,			/* 14 - LATIN CAPITAL LETTER A WITH RING ABOVE */
+  0x00E5,			/* 15 - LATIN SMALL LETTER A WITH RING ABOVE */
+  0x0394,			/* 16 - GREEK CAPITAL LETTER DELTA */
+  0x005F,			/* 17 - LOW LINE */
+  0x03A6,			/* 18 - GREEK CAPITAL LETTER PHI */
+  0x0393,			/* 19 - GREEK CAPITAL LETTER GAMMA */
+  0x039B,			/* 20 - GREEK CAPITAL LETTER LAMBDA */
+  0x03A9,			/* 21 - GREEK CAPITAL LETTER OMEGA */
+  0x03A0,			/* 22 - GREEK CAPITAL LETTER PI */
+  0x03A8,			/* 23 - GREEK CAPITAL LETTER PSI */
+  0x03A3,			/* 24 - GREEK CAPITAL LETTER SIGMA */
+  0x0398,			/* 25 - GREEK CAPITAL LETTER THETA */
+  0x039E,			/* 26 - GREEK CAPITAL LETTER XI */
+  0x0000,			/* 27 - ESCAPE TO EXTENSION TABLE */
+  0x00C6,			/* 28 - LATIN CAPITAL LETTER AE */
+  0x00E6,			/* 29 - LATIN SMALL LETTER AE */
+  0x00DF,			/* 30 - LATIN SMALL LETTER SHARP S (German) */
+  0x00C9,			/* 31 - LATIN CAPITAL LETTER E WITH ACUTE */
+  0x0020,			/* 32 - SPACE */
+  0x0021,			/* 33 - EXCLAMATION MARK */
+  0x0022,			/* 34 - QUOTATION MARK */
+  0x0023,			/* 35 - NUMBER SIGN */
+  0x00A4,			/* 36 - CURRENCY SIGN */
+  0x0025,			/* 37 - PERCENT SIGN */
+  0x0026,			/* 38 - AMPERSAND */
+  0x0027,			/* 39 - APOSTROPHE */
+  0x0028,			/* 40 - LEFT PARENTHESIS */
+  0x0029,			/* 41 - RIGHT PARENTHESIS */
+  0x002A,			/* 42 - ASTERISK */
+  0x002B,			/* 43 - PLUS SIGN */
+  0x002C,			/* 44 - COMMA */
+  0x002D,			/* 45 - HYPHEN-MINUS */
+  0x002E,			/* 46 - FULL STOP */
+  0x002F,			/* 47 - SOLIDUS */
+  0x0030,			/* 48 - DIGIT ZERO */
+  0x0031,			/* 49 - DIGIT ONE */
+  0x0032,			/* 50 - DIGIT TWO */
+  0x0033,			/* 51 - DIGIT THREE */
+  0x0034,			/* 52 - DIGIT FOUR */
+  0x0035,			/* 53 - DIGIT FIVE */
+  0x0036,			/* 54 - DIGIT SIX */
+  0x0037,			/* 55 - DIGIT SEVEN */
+  0x0038,			/* 56 - DIGIT EIGHT */
+  0x0039,			/* 57 - DIGIT NINE */
+  0x003A,			/* 58 - COLON */
+  0x003B,			/* 59 - SEMICOLON */
+  0x003C,			/* 60 - LESS-THAN SIGN */
+  0x003D,			/* 61 - EQUALS SIGN */
+  0x003E,			/* 62 - GREATER-THAN SIGN */
+  0x003F,			/* 63 - QUESTION MARK */
+  0x00A1,			/* 64 - INVERTED EXCLAMATION MARK */
+  0x0041,			/* 65 - LATIN CAPITAL LETTER A */
+  0x0042,			/* 66 - LATIN CAPITAL LETTER B */
+  0x0043,			/* 67 - LATIN CAPITAL LETTER C */
+  0x0044,			/* 68 - LATIN CAPITAL LETTER D */
+  0x0045,			/* 69 - LATIN CAPITAL LETTER E */
+  0x0046,			/* 70 - LATIN CAPITAL LETTER F */
+  0x0047,			/* 71 - LATIN CAPITAL LETTER G */
+  0x0048,			/* 72 - LATIN CAPITAL LETTER H */
+  0x0049,			/* 73 - LATIN CAPITAL LETTER I */
+  0x004A,			/* 74 - LATIN CAPITAL LETTER J */
+  0x004B,			/* 75 - LATIN CAPITAL LETTER K */
+  0x004C,			/* 76 - LATIN CAPITAL LETTER L */
+  0x004D,			/* 77 - LATIN CAPITAL LETTER M */
+  0x004E,			/* 78 - LATIN CAPITAL LETTER N */
+  0x004F,			/* 79 - LATIN CAPITAL LETTER O */
+  0x0050,			/* 80 - LATIN CAPITAL LETTER P */
+  0x0051,			/* 81 - LATIN CAPITAL LETTER Q */
+  0x0052,			/* 82 - LATIN CAPITAL LETTER R */
+  0x0053,			/* 83 - LATIN CAPITAL LETTER S */
+  0x0054,			/* 84 - LATIN CAPITAL LETTER T */
+  0x0055,			/* 85 - LATIN CAPITAL LETTER U */
+  0x0056,			/* 86 - LATIN CAPITAL LETTER V */
+  0x0057,			/* 87 - LATIN CAPITAL LETTER W */
+  0x0058,			/* 88 - LATIN CAPITAL LETTER X */
+  0x0059,			/* 89 - LATIN CAPITAL LETTER Y */
+  0x005A,			/* 90 - LATIN CAPITAL LETTER Z */
+  0x00C4,			/* 91 - LATIN CAPITAL LETTER A WITH DIAERESIS */
+  0x00D6,			/* 92 - LATIN CAPITAL LETTER O WITH DIAERESIS */
+  0x00D1,			/* 93 - LATIN CAPITAL LETTER N WITH TILDE */
+  0x00DC,			/* 94 - LATIN CAPITAL LETTER U WITH DIAERESIS */
+  0x00A7,			/* 95 - SECTION SIGN */
+  0x00BF,			/* 96 - INVERTED QUESTION MARK */
+  0x0061,			/* 97 - LATIN SMALL LETTER A */
+  0x0062,			/* 98 - LATIN SMALL LETTER B */
+  0x0063,			/* 99 - LATIN SMALL LETTER C */
+  0x0064,			/* 100 - LATIN SMALL LETTER D */
+  0x0065,			/* 101 - LATIN SMALL LETTER E */
+  0x0066,			/* 102 - LATIN SMALL LETTER F */
+  0x0067,			/* 103 - LATIN SMALL LETTER G */
+  0x0068,			/* 104 - LATIN SMALL LETTER H */
+  0x0069,			/* 105 - LATIN SMALL LETTER I */
+  0x006A,			/* 106 - LATIN SMALL LETTER J */
+  0x006B,			/* 107 - LATIN SMALL LETTER K */
+  0x006C,			/* 108 - LATIN SMALL LETTER L */
+  0x006D,			/* 109 - LATIN SMALL LETTER M */
+  0x006E,			/* 110 - LATIN SMALL LETTER N */
+  0x006F,			/* 111 - LATIN SMALL LETTER O */
+  0x0070,			/* 112 - LATIN SMALL LETTER P */
+  0x0071,			/* 113 - LATIN SMALL LETTER Q */
+  0x0072,			/* 114 - LATIN SMALL LETTER R */
+  0x0073,			/* 115 - LATIN SMALL LETTER S */
+  0x0074,			/* 116 - LATIN SMALL LETTER T */
+  0x0075,			/* 117 - LATIN SMALL LETTER U */
+  0x0076,			/* 118 - LATIN SMALL LETTER V */
+  0x0077,			/* 119 - LATIN SMALL LETTER W */
+  0x0078,			/* 120 - LATIN SMALL LETTER X */
+  0x0079,			/* 121 - LATIN SMALL LETTER Y */
+  0x007A,			/* 122 - LATIN SMALL LETTER Z */
+  0x00E4,			/* 123 - LATIN SMALL LETTER A WITH DIAERESIS */
+  0x00F6,			/* 124 - LATIN SMALL LETTER O WITH DIAERESIS */
+  0x00F1,			/* 125 - LATIN SMALL LETTER N WITH TILDE */
+  0x00FC,			/* 126 - LATIN SMALL LETTER U WITH DIAERESIS */
+  0x00E0,			/* 127 - LATIN SMALL LETTER A WITH GRAVE */
+};
+
+/* Extension table */
+unsigned short sms_7bit_to_utf8_table_ext[] = {
+  0x0000,			/* 00 - ? */
+  0x0000,			/* 01 - ? */
+  0x003F,			/* 02 - ? */
+  0x0000,			/* 03 - ? */
+  0x0000,			/* 04 - ? */
+  0x0000,			/* 05 - ? */
+  0x0000,			/* 06 - ? */
+  0x0000,			/* 07 - ? */
+  0x0000,			/* 08 - ? */
+  0x0000,			/* 09 - ? */
+  0x0000,			/* 0A - ? */
+  0x0000,			/* 0B - ? */
+  0x0000,			/* 0C - ? */
+  0x0000,			/* 0D - ? */
+  0x0000,			/* 0E - ? */
+  0x0000,			/* 0F - ? */
+  0x0000,			/* 10 - ? */
+  0x0000,			/* 11 - ? */
+  0x0000,			/* 12 - ? */
+  0x0000,			/* 13 - ? */
+  0x005E,			/* 14 - CIRCUMFLEX ACCENT */
+  0x0000,			/* 15 - ? */
+  0x0000,			/* 16 - ? */
+  0x0000,			/* 17 - ? */
+  0x0000,			/* 18 - ? */
+  0x0000,			/* 19 - ? */
+  0x0000,			/* 1A - ? */
+  0x0000,			/* 1B - ? */
+  0x0000,			/* 1C - ? */
+  0x0000,			/* 1D - ? */
+  0x0000,			/* 1E - ? */
+  0x0000,			/* 1F - ? */
+  0x0000,			/* 20 - ? */
+  0x0000,			/* 21 - ? */
+  0x0000,			/* 22 - ? */
+  0x0000,			/* 23 - ? */
+  0x0000,			/* 24 - ? */
+  0x0000,			/* 25 - ? */
+  0x0000,			/* 26 - ? */
+  0x0000,			/* 27 - ? */
+  0x007B,			/* 28 - LEFT CURLY BRACKET */
+  0x007D,			/* 29 - RIGHT CURLY BRACKET */
+  0x0000,			/* 2A - ? */
+  0x0000,			/* 2B - ? */
+  0x0000,			/* 2C - ? */
+  0x0000,			/* 2D - ? */
+  0x0000,			/* 2E - ? */
+  0x005C,			/* 2F - REVERSE SOLIDUS */
+  0x0000,			/* 30 - ? */
+  0x0000,			/* 31 - ? */
+  0x0000,			/* 32 - ? */
+  0x0000,			/* 33 - ? */
+  0x0000,			/* 34 - ? */
+  0x0000,			/* 35 - ? */
+  0x0000,			/* 36 - ? */
+  0x0000,			/* 37 - ? */
+  0x0000,			/* 38 - ? */
+  0x0000,			/* 39 - ? */
+  0x0000,			/* 3A - ? */
+  0x0000,			/* 3B - ? */
+  0x005B,			/* 3C - LEFT SQUARE BRACKET */
+  0x007E,			/* 3D - TILDE */
+  0x005D,			/* 3E - RIGHT SQUARE BRACKET */
+  0x0000,			/* 3F - ? */
+  0x007C,			/* 40 - VERTICAL LINE */
+};
+
+#endif
diff --git a/panel-plugin/pin_helper.h b/panel-plugin/sms_tables.h
similarity index 63%
copy from panel-plugin/pin_helper.h
copy to panel-plugin/sms_tables.h
index 6b949ce..a33ba7f 100644
--- a/panel-plugin/pin_helper.h
+++ b/panel-plugin/sms_tables.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Alvaro Lopes <alvieboy at alvie.com>
+ * Copyright (c) 2007 Alvaro Lopes <alvieboy at alvie.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,25 +16,28 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifndef __PIN_HELPER_H__
-#define __PIN_HELPER_H__
+#ifndef __SMSTABLES_H__
+#define __SMSTABLES_H__
 
-#include "cellmodem.h"
+#include "config.h"
 
-typedef void (*pin_helper_callback) (const gchar * pin, void *pvt);
+#ifdef HAVE_SMS_SUPPORT
 
-typedef struct pin_dialog_t
-{
-  GtkWidget *entry;
-  GtkWidget *dlg;
-  pin_helper_callback cb;
-  void *pvt;
-} pin_dialog_t;
+#include <glib.h>
+
+extern unsigned short sms_7bit_to_utf8_table[];
+extern unsigned short sms_7bit_to_utf8_table_ext[];
 
+#define SMS_EXTENDED_TABLE_SIZE 0x41
 
+#define SMS_ESCAPE_CHARACTER 27
 
-void pin_helper_launch (GtkWidget * parent, pin_helper_callback callback,
-			void *pvt);
+typedef enum
+{
+  STATE_ALPHABET_NORMAL,
+  STATE_ALPHABET_EXTENDED
+} sms_7bit_state_t;
 
+#endif
 
 #endif



More information about the Xfce4-commits mailing list