Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/EionRobb/skype4pidgin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEion Robb <eion@robbmob.com>2007-11-20 07:48:24 +0300
committerEion Robb <eion@robbmob.com>2007-11-20 07:48:24 +0300
commit78d238001c902be339d3bf03d95cad7ef6640197 (patch)
tree129b19c54975758e260d1a6b5eb778631c66a37f /skype_messaging_carbon2.c
parent37ba6a970af80b962b3d98e9eadf77da7609e42c (diff)
It works! IsSkypeRunning detects perfectly and SendSkypeCommand actually sends something
Diffstat (limited to 'skype_messaging_carbon2.c')
-rwxr-xr-xskype_messaging_carbon2.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/skype_messaging_carbon2.c b/skype_messaging_carbon2.c
index 530cbd5..6c79b5c 100755
--- a/skype_messaging_carbon2.c
+++ b/skype_messaging_carbon2.c
@@ -228,24 +228,37 @@ IsSkypeRunning(void)
{
OSStatus status = noErr;
ProcessSerialNumber psn = {kNoProcess, kNoProcess};
- char procName[64];
+ unsigned int procNameLength = 32;
+ unsigned char procName[procNameLength];
+ unsigned int i = 0;
ProcessInfoRec info;
info.processInfoLength = sizeof(ProcessInfoRec);
info.processName = procName;
info.processAppSpec = NULL;
+ pid_t pid = 0;
while(status == noErr)
{
+ for(i = 0; i < procNameLength; i++)
+ procName[i] = '\0';
+
status = GetNextProcess(&psn);
if (status == noErr)
{
if (GetProcessInformation(&psn, &info) == noErr)
{
- printf("Program name %s\n", info.processName);
+ //for some reason first character is poisioned
+ if (strcmp((char *)&procName[1], "Skype") == 0)
+ {
+ if (GetProcessPID(&psn, &pid) == noErr)
+ {
+ return (int)pid;
+ }
+ }
}
}
}
- return 1;
+ return 0;
}
void
@@ -285,7 +298,7 @@ void SendSkypeCommand(CFStringRef command)
{
CFNumberRef id_number = CFNumberCreate(NULL, kCFNumberIntType, &client_id);
CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter();
- const void *keys[] = {(void *)CFSTR("SKYPE_API_NOTIFICATION_STRING"), (void *)CFSTR("SKYPE_API_CLIENT_ID")};
+ const void *keys[] = {(void *)CFSTR("SKYPE_API_COMMAND"), (void *)CFSTR("SKYPE_API_CLIENT_ID")};
const void *values[] = {command, id_number};
CFDictionaryRef userInfo = CFDictionaryCreate(NULL, keys, values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);