Commits

Hector Miuler Malpica Gallegos committed e90e37c

arreglando para que no se quede pegado el programa smtpmock al cerrar

Comments (0)

Files changed (2)

 
 name := "MockSMTP"
 
-version := "1.0"
+version := "0.9"
 
 libraryDependencies ++= Seq(
     "junit" % "junit" % "4.10" % "test",

src/main/scala/com/miuler/mocksmtp/gui/MainGUI.scala

  * To change this template use File | Settings | File Templates.
  */
 class MainGUI(id: String = null, serverId: String = null) {
-  QApplication.initialize(Array())
+  QApplication.initialize(Array[String]())
   new MainWindowSMTP()
   QApplication.exec()
 }
     }
     if (threadConnectionThreadNetty.isAlive) {
       connectionTheadNetty.loopConnectionNetty = false
+      connectionTheadNetty.msg = null
       connectionTheadNetty.mutex.unlock
     }
+    super.closeEvent(evn)
   }
 
   def addEmail(msg: String) {
-    val email = new MimeMessage(session, new ByteArrayInputStream(msg.getBytes()))
-    val date = new DateTime()
+    if (msg!=null & msg!="") {
+      val email = new MimeMessage(session, new ByteArrayInputStream(msg.getBytes()))
+      val date = new DateTime()
 
-    systray.showMessage("LLego un correo", email.getSubject)
+      systray.showMessage("LLego un correo", email.getSubject)
 
-    emails.append(email)
-    model.insertRow(0)
-    model.setData(model.index(0, 0), model.rowCount())
-    //model.setData(model.index(0, 1), DateTimeFormat.forPattern("M-dd HH:mm").print(date))
-    model.setData(model.index(0, 1), date.toString("M-dd HH:mm"))
-    model.setData(model.index(0, 2), email.getSubject())
-    model.setData(model.index(0, 3), date)
-    model.setData(model.index(0, 4), email)
-    lcd.display(model.rowCount())
+      emails.append(email)
+      model.insertRow(0)
+      model.setData(model.index(0, 0), model.rowCount())
+      //model.setData(model.index(0, 1), DateTimeFormat.forPattern("M-dd HH:mm").print(date))
+      model.setData(model.index(0, 1), date.toString("M-dd HH:mm"))
+      model.setData(model.index(0, 2), email.getSubject())
+      model.setData(model.index(0, 3), date)
+      model.setData(model.index(0, 4), email)
+      lcd.display(model.rowCount())
+    }
   }
 
   def onCleanEmails() {