void abuse_dog(struct monst *mtmp) { if (!mtmp->mtame) return; if (Aggravate_monster || Conflict) mtmp->mtame /= 2; else mtmp->mtame--; if (mtmp->mtame && !mtmp->isminion) EDOG(mtmp)->abuse++; if (!mtmp->mtame && mtmp->mleashed) m_unleash(mtmp, TRUE); /* don't make a sound if pet is in the middle of leaving the level */ /* newsym isn't necessary in this case either */ if (mtmp->mx != COLNO) { if (mtmp->mtame && rn2(mtmp->mtame)) yelp(mtmp); else growl(mtmp); /* give them a moment's worry */ if (!mtmp->mtame && mtmp->dlevel == level) newsym(mtmp->mx, mtmp->my); } }
void GrowlNotify(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow) { char* server = "127.0.0.1:23053"; char* password = NULL; char* appname = "gntp-send"; char* notify = "gntp-send notify"; char* title = NULL; char* message = NULL; char* icon = NULL; char* url = NULL; char* first = strdup(lpszCmdLine); char* ptr = first; int rc; WSADATA wsaData; if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) return; #define SKIP(x) while (*x && *x != ' ') x++; if (*x == ' ') *x++ = 0; server = ptr; SKIP(ptr); appname = ptr; SKIP(ptr); notify = ptr; SKIP(ptr); title = ptr; SKIP(ptr); message = ptr; SKIP(ptr); icon = ptr; SKIP(ptr); url = ptr; SKIP(ptr); rc = growl(server,appname,notify,title,message,icon,password,url); WSACleanup(); free(ptr); }
void KCNotificationCenter::notify(const QString &id, const QString &title, const QString &message, bool defaultToEnabled) { if(!enabledNotifications.value(id, defaultToEnabled)) return; if(backend == GrowlBackend) { // We need to keep these byte arrays around, or constData() would yield a // dangling pointer, as the byte arrays would be but fleeting temporaries QByteArray utf8_id = id.toUtf8(); QByteArray utf8_title = title.toUtf8(); QByteArray utf8_message = message.toUtf8(); growl("localhost", "KanColleTool", utf8_id.constData(), utf8_title.constData(), utf8_message.constData(), "http://i.imgur.com/LeHyDub.png", NULL, NULL); } else { trayIcon->showMessage(title, message); } }
int main(int argc, char* argv[]) { int c; int rc; char* server = NULL; char* password = NULL; char* appname = "gntp-send"; char* notify = "gntp-send notify"; char* title = NULL; char* message = NULL; char* icon = NULL; char* url = NULL; int tcpsend = 1; opterr = 0; while ((c = getopts(argc, argv, "a:n:s:p:u") != -1)) { switch (optopt) { case 'a': appname = optarg; break; case 'n': notify = optarg; break; case 's': server = optarg; break; case 'p': password = optarg; break; case 'u': tcpsend = 0; break; case '?': break; default: argc = 0; break; } optarg = NULL; } if ((argc - optind) < 2 || (argc - optind) > 4) { fprintf(stderr, "%s: [-u] [-a APPNAME] [-n NOTIFY] [-s SERVER:PORT] [-p PASSWORD] title message [icon] [url]\n", argv[0]); exit(1); } title = string_to_utf8_alloc(argv[optind]); message = string_to_utf8_alloc(argv[optind + 1]); if ((argc - optind) >= 3) icon = string_to_utf8_alloc(argv[optind + 2]); if ((argc - optind) == 4) url = string_to_utf8_alloc(argv[optind + 3]); if (!server) server = "127.0.0.1"; growl_init(); if (tcpsend) { rc = growl(server,appname,notify,title,message,icon,password,url); } else { rc = growl_udp(server,appname,notify,title,message,icon,password,url); } growl_shutdown(); if (title) free(title); if (message) free(message); if (icon) free(icon); if (url) free(url); return rc; }