summaryrefslogtreecommitdiffabout
path: root/gammu
authorzautrix <zautrix>2004-09-12 13:11:10 (UTC)
committer zautrix <zautrix>2004-09-12 13:11:10 (UTC)
commitb2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26 (patch) (side-by-side diff)
treea25dbba0cac09b7a7892405b11eb08c7d02e6b6b /gammu
parent3c954091cb8d90c185403c68a8bbbb2a961f67fe (diff)
downloadkdepimpi-b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26.zip
kdepimpi-b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26.tar.gz
kdepimpi-b2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26.tar.bz2
many phonesync fixes
Diffstat (limited to 'gammu') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmcal.c2
-rw-r--r--gammu/emb/gammu/gammu.c41
2 files changed, 35 insertions, 8 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c
index 598292c..ddf9790 100644
--- a/gammu/emb/common/service/gsmcal.c
+++ b/gammu/emb/common/service/gsmcal.c
@@ -113,65 +113,65 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
case GSM_CAL_MEETING:
default:
*Length+=sprintf(Buffer+(*Length), "MeetingDEF%c%c",13,10);
break;
}
if (note->Type == GSM_CAL_CALL) {
buffer[0] = 0;
buffer[1] = 0;
if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text);
if (Text != -1) {
if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1);
CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text);
}
SaveVCALText(Buffer, Length, buffer, "SUMMARY");
} else {
SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY");
}
if (note->Type == GSM_CAL_MEETING && Location != -1) {
SaveVCALText(Buffer, Length, note->Entries[Location].Text, "LOCATION");
}
if (Time == -1) return ERR_UNKNOWN;
SaveVCALDateTime(Buffer, Length, &note->Entries[Time].Date, "DTSTART");
if (EndTime != -1) {
SaveVCALDateTime(Buffer, Length, &note->Entries[EndTime].Date, "DTEND");
}
if (Alarm != -1) {
if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) {
SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM");
} else {
- SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "AALARM");
+ SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM");
}
}
/* Birthday is known to be recurranced */
if (Recurrance != -1 && note->Type != GSM_CAL_BIRTHDAY) {
switch(note->Entries[Recurrance].Number/24) {
case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break;
case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break;
case 14 : *Length+=sprintf(Buffer+(*Length), "RRULE:W2 #0%c%c",13,10); break;
case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1 #0%c%c",13,10); break;
}
}
} else if (Version == Siemens_VCalendar) {
*Length+=sprintf(Buffer+(*Length), "CATEGORIES:");
switch (note->Type) {
case GSM_CAL_MEETING:
*Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10);
break;
case GSM_CAL_CALL:
*Length+=sprintf(Buffer+(*Length), "Phone Call%c%c",13,10);
break;
case GSM_CAL_BIRTHDAY:
*Length+=sprintf(Buffer+(*Length), "Anniversary%c%c",13,10);
break;
case GSM_CAL_MEMO:
default:
*Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10);
break;
}
if (Time == -1) return ERR_UNKNOWN;
SaveVCALDateTime(Buffer, Length, &note->Entries[Time].Date, "DTSTART");
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c
index 5163d81..a3b93a8 100644
--- a/gammu/emb/gammu/gammu.c
+++ b/gammu/emb/gammu/gammu.c
@@ -8212,190 +8212,217 @@ int main(int argc, char *argv[])
static int only_config ;
#if !defined(WIN32) && defined(LOCALE_PATH)
static char *locale, locale_file[201];
#endif
static char *cp;
static bool count_failed;
z = 0;
start=0;only_config = -1;count_failed = false;
s.opened = false;
s.msg = NULL;
s.ConfigNum = 0;
setlocale(LC_ALL, "");
#ifdef DEBUG
di.dl = DL_TEXTALL;
di.df = stdout;
#endif
//#if 0
/* Any parameters? */
if (argc == 1) {
HelpGeneral();
printmsg("Too few parameters!\n");
exit(1);
}
/* Help? */
if (strncmp(argv[1 + start], "--help", 6) == 0) {
Help(argc - start, argv + start);
exit(1);
}
/* Is first parameter numeric? If so treat it as config that should be loaded. */
- if (isdigit(argv[1][0])) {
- only_config = atoi(argv[1]);
- if (only_config >= 0) start++; else only_config = -1;
- }
-
+ //if (isdigit(argv[1][0])) {
+ //only_config = atoi(argv[1]);
+ //if (only_config >= 0) start++; else only_config = -1;
+ //}
+ only_config = 0;;
+#if 0
GSM_ReadConfig(NULL, &s.Config[0], 0);
s.ConfigNum = 1;
GSM_Config *con = &s.Config[0];
char* tempC;
tempC = argv[argc-1]+2;
if ( *tempC != 0 ) {
fprintf(stderr,"Using model %s \n",tempC);
strcpy(con->Model,tempC );
}
tempC = argv[argc-2]+2;
if ( *tempC != 0 ) {
fprintf(stderr,"Using device %s \n",tempC);
con->Device = strdup(tempC);
con->DefaultDevice = false;
}
tempC = argv[argc-3]+2;
if ( *tempC != 0 ) {
fprintf(stderr,"Using connection %s \n",tempC);
con->Connection = strdup(tempC);
con->DefaultConnection = false;
}
argc = argc-3;
-#if 0
+ //#if 0
if ( ! mConnection.isEmpty() ) {
cfg->Connection = strdup(mConnection.latin1());
cfg->DefaultConnection = false;
qDebug("Connection set %s ", cfg->Connection );
}
if ( ! mDevice.isEmpty() ) {
cfg->Device = strdup(mDevice.latin1());
cfg->DefaultDevice = false;
qDebug("Device set %s ", cfg->Device);
}
if ( ! mModel.isEmpty() ) {
strcpy(cfg->Model,mModel.latin1() );
cfg->DefaultModel = false;
qDebug("Model set %s ",cfg->Model );
}
#endif
-#if 0
+
cfg=GSM_FindGammuRC();
for (i = 0; i <= MAX_CONFIG_NUM; i++) {
if (cfg!=NULL) {
cp = INI_GetValue(cfg, "gammu", "gammucoding", false);
if (cp) di.coding = cp;
s.Config[i].Localize = INI_GetValue(cfg, "gammu", "gammuloc", false);
if (s.Config[i].Localize) {
s.msg=INI_ReadFile(s.Config[i].Localize, true);
} else {
#if !defined(WIN32) && defined(LOCALE_PATH)
locale = setlocale(LC_MESSAGES, NULL);
if (locale != NULL) {
snprintf(locale_file, 200, "%s/gammu_%c%c.txt",
LOCALE_PATH,
tolower(locale[0]),
tolower(locale[1]));
s.msg = INI_ReadFile(locale_file, true);
}
#endif
}
}
/* Wanted user specific configuration? */
+
if (only_config != -1) {
/* Here we get only in first for loop */
if (!GSM_ReadConfig(cfg, &s.Config[0], only_config)) break;
} else {
if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break;
}
s.ConfigNum++;
/* We want to use only one file descriptor for global and state machine debug output */
s.Config[i].UseGlobalDebugFile = true;
/* It makes no sense to open several debug logs... */
if (i != 0) {
strcpy(s.Config[i].DebugLevel, s.Config[0].DebugLevel);
free(s.Config[i].DebugFile);
s.Config[i].DebugFile = strdup(s.Config[0].DebugFile);
} else {
/* Just for first config */
/* When user gave debug level on command line */
if (argc > 1 + start && GSM_SetDebugLevel(argv[1 + start], &di)) {
/* Debug level from command line will be used with phone too */
strcpy(s.Config[i].DebugLevel,argv[1 + start]);
start++;
} else {
/* Try to set debug level from config file */
GSM_SetDebugLevel(s.Config[i].DebugLevel, &di);
}
/* If user gave debug file in gammurc, we will use it */
error=GSM_SetDebugFile(s.Config[i].DebugFile, &di);
Print_Error(error);
}
/* We wanted to read just user specified configuration. */
if (only_config != -1) {break;}
}
+#if 0
+ GSM_Config *con = &s.Config[0];
+
+ char* tempC;
+ tempC = argv[argc-1]+2;
+ if ( *tempC != 0 ) {
+ fprintf(stderr,"Using model %s \n",tempC);
+ strcpy(con->Model,tempC );
+ }
+ tempC = argv[argc-2]+2;
+ if ( *tempC != 0 ) {
+ fprintf(stderr,"Using device %s \n",tempC);
+ con->Device = strdup(tempC);
+ con->DefaultDevice = false;
+ }
+ tempC = argv[argc-3]+2;
+ if ( *tempC != 0 ) {
+ fprintf(stderr,"Using connection %s \n",tempC);
+ con->Connection = strdup(tempC);
+ con->DefaultConnection = false;
+ }
#endif
+ argc = argc-3;
+
+
/* Do we have enough parameters? */
if (argc == 1 + start) {
HelpGeneral();
printmsg("Too few parameters!\n");
exit(-2);
}
/* Check used version vs. compiled */
if (!mystrncasecmp(GetGammuVersion(),VERSION,0)) {
printmsg("ERROR: version of installed libGammu.so (%s) is different to version of Gammu (%s)\n",
GetGammuVersion(),VERSION);
exit(-1);
}
/* Check parameters */
while (Parameters[z].Function != NULL) {
if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) {
if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) {
+ fprintf(stderr,"Executing \n");
Parameters[z].Function(argc - start, argv + start);
break;
} else {
count_failed = true;
}
}
z++;
}
/* Tell user when we did nothing */
if (Parameters[z].Function == NULL) {
HelpGeneral();
if (count_failed) {
printmsg("Bad parameter count!\n");
} else {
printmsg("Bad option!\n");
}
}
/* Close debug output if opened */
if (di.df!=stdout) fclose(di.df);
//#endif // 0
fprintf(stderr,"kammu: Success. End. \n");
exit(0);
}
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/