Author: iratqq
Date: Mon Dec 31 13:26:55 2007
New Revision: 5081

Modified:
  trunk/notify/uim-knotify.cc

Log:
* notify/uim-knotify.cc
 - (send_knotify): Correct arguments, add level mask,
   remove shadowed parameter.
 - (uim_notify_plugin_info, uim_notify_plugin_fatal): Simply.


Modified: trunk/notify/uim-knotify.cc
==============================================================================
--- trunk/notify/uim-knotify.cc (original)
+++ trunk/notify/uim-knotify.cc Mon Dec 31 13:26:55 2007
@@ -56,15 +56,21 @@
}

static int
-send_knotify(char event, char msg, int level)
+send_knotify(const char *eventstr, const char *msg, int level)
{
+  char body[BUFSIZ];
+  char body_short[256];
  QByteArray data;
  QDataStream arg(data, IO_WriteOnly);
-  QString event(event), fromApp("uim"), text(msg), sound(""), file("");
-  int present = KNotifyClient::Messagebox;
+  QString event(eventstr), fromApp("uim"), text, sound(""), file("");
+  int present = KNotifyClient::Messagebox | level;

+  snprintf(body, sizeof(body), "uim: %s", msg);
  fprintf(stderr, "%s\n", msg);

+  strlcpy(body_short, body, sizeof(body_short));
+  text = body_short;
+
  if (!kapp->dcopClient()->attach()) {
    fprintf(stderr, "uim: cannot connect DCOP\n");
    return 0;
@@ -81,23 +87,11 @@
int
uim_notify_plugin_info(const char *msg)
{
-  char body[BUFSIZ];
-  char body_short[256];
-
-  snprintf(body, sizeof(body), "uim: %s", msg);
-  strlcpy(body_short, body, sizeof(body_short));
-
-  return send_knotify("Info", body_short, KNotifyClient::Notification);
+  return send_knotify("Info", msg, KNotifyClient::Notification);
}

int
uim_notify_plugin_fatal(const char *msg)
{
-  char body[BUFSIZ];
-  char body_short[256];
-
-  snprintf(body, sizeof(body), "uim: %s", msg);
-  strlcpy(body_short, body, sizeof(body_short));
-
-  return send_knotify("Fatal", body_short, KNotifyClient::Error);
+  return send_knotify("Fatal", msg, KNotifyClient::Error);
}

Reply via email to