A new hacky way to work with getLocalPrefix
diff --git a/chatdialog.cpp b/chatdialog.cpp
index fba460b..0067fd1 100644
--- a/chatdialog.cpp
+++ b/chatdialog.cpp
@@ -545,40 +545,55 @@
   return randStr.c_str();
 }
 
-QString
+void
 ChatDialog::getLocalPrefix()
 {
-  /* 
-   * this method tries to use ccncat 
-   * however, it does not work in Mac OS X app bundle
-   * it works well in command line though
-   */
+//   /* 
+//    * this method tries to use ccncat 
+//    * however, it does not work in Mac OS X app bundle
+//    * it works well in command line though
+//    */
 
-  std::string cmd = CCN_EXEC;
-  cmd += " -c -v ";
-  cmd += LOCAL_PREFIX_QUERY;
-  QString localPrefix;
-#define MAX_PREFIX_LEN 100
-  FILE *fp = popen(cmd.c_str(), "r");
-  if (fp != NULL)
-  {
-    char prefix[MAX_PREFIX_LEN];
-    if (fgets(prefix, MAX_PREFIX_LEN, fp) != NULL)
+//   std::string cmd = CCN_EXEC;
+//   cmd += " -c -v ";
+//   cmd += LOCAL_PREFIX_QUERY;
+//   QString localPrefix;
+// #define MAX_PREFIX_LEN 100
+//   FILE *fp = popen(cmd.c_str(), "r");
+//   if (fp != NULL)
+//   {
+//     char prefix[MAX_PREFIX_LEN];
+//     if (fgets(prefix, MAX_PREFIX_LEN, fp) != NULL)
+//     {
+//       localPrefix = prefix;
+//       localPrefix.remove('\n');
+//     }
+//     else
+//     {
+//       localPrefix = DEFAULT_LOCAL_PREFIX;
+//     }
+//     pclose(fp);
+//   }
+//   else
+//   {
+//     localPrefix = DEFAULT_LOCAL_PREFIX;
+//   }
+//   return localPrefix;
+
+  if (m_sock != NULL)
     {
-      localPrefix = prefix;
-      localPrefix.remove('\n');
+      QString originPrefix = QString::fromStdString (m_sock->getLocalPrefix());
+      if (originPrefix != "" && m_user.getOriginPrefix () != originPrefix)
+        {
+          m_user.setOriginPrefix(originPrefix);
+          emit settingUpdated(m_user.getNick (), m_user.getChatroom (), m_user.getOriginPrefix ());
+          // connect(&dialog, SIGNAL(updated(QString, QString, QString)), this, SLOT());
+        }
     }
-    else
-    {
-      localPrefix = DEFAULT_LOCAL_PREFIX;
-    }
-    pclose(fp);
-  }
   else
-  {
-    localPrefix = DEFAULT_LOCAL_PREFIX;
-  }
-  return localPrefix;
+    {
+      // QTimer::singleShot(1000, this, SLOT(getLocalPrefix())); // try again
+    }
 }
 
 bool
@@ -587,8 +602,15 @@
   QSettings s(ORGANIZATION, APPLICATION);
   QString nick = s.value("nick", "").toString();
   QString chatroom = s.value("chatroom", "").toString();
-  //QString originPrefix = s.value("originPrefix", "").toString();
-  QString originPrefix = getLocalPrefix();
+  QString originPrefix = s.value("originPrefix", "").toString();
+
+  // Sync::CcnxWrapperPtr wrapper = Sync::CcnxWrapper::Create ();
+  // QString originPrefix = QString::fromStdString (wrapper->getLocalPrefix());
+  // Sync::CcnxWrapper::Destroy ();
+  // QString originPrefix = DEFAULT_LOCAL_PREFIX;
+  
+  QTimer::singleShot(500, this, SLOT(getLocalPrefix()));
+  
   m_minimaniho = s.value("minimaniho", false).toBool();
   if (nick == "" || chatroom == "" || originPrefix == "") {
     QTimer::singleShot(500, this, SLOT(buttonPressed()));
@@ -714,6 +736,9 @@
 void
 ChatDialog::buttonPressed()
 {
+  Sync::SyncLogic &logic = m_sock->getLogic ();
+  logic.printState ();
+  
   SettingDialog dialog(this, m_user.getNick(), m_user.getChatroom(), m_user.getOriginPrefix());
   connect(&dialog, SIGNAL(updated(QString, QString, QString)), this, SLOT(settingUpdated(QString, QString, QString)));
   dialog.exec();
diff --git a/chatdialog.h b/chatdialog.h
index a801931..69cfcfb 100644
--- a/chatdialog.h
+++ b/chatdialog.h
@@ -64,7 +64,7 @@
   QString formatTime(time_t);
   void printTimeInCell(QTextTable *, time_t);
   void disableTreeDisplay();
-  QString getLocalPrefix();
+  void getLocalPrefix();
 
 private slots:
   void returnPressed();
diff --git a/sync b/sync
index 60126e0..50f7e9f 160000
--- a/sync
+++ b/sync
@@ -1 +1 @@
-Subproject commit 60126e01a5173cdd5324758226a81f0647f3075d
+Subproject commit 50f7e9f4d5945fe88df35b8fc69d016d32d53771