-rw-r--r-- | gammu/emb/gammu/gammu.c | 4 | ||||
-rw-r--r-- | gammu/gammu.tar.bz2 | bin | 612042 -> 0 bytes |
2 files changed, 2 insertions, 2 deletions
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c index f49ae36..c436b90 100644 --- a/gammu/emb/gammu/gammu.c +++ b/gammu/emb/gammu/gammu.c | |||
@@ -4682,193 +4682,193 @@ static void Restore(int argc, char *argv[]) | |||
4682 | if (Backup.PhonePhonebook[0] != NULL) { | 4682 | if (Backup.PhonePhonebook[0] != NULL) { |
4683 | MemStatus.MemoryType = MEM_ME; | 4683 | MemStatus.MemoryType = MEM_ME; |
4684 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 4684 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
4685 | if (error==ERR_NONE) { | 4685 | if (error==ERR_NONE) { |
4686 | max = 0; | 4686 | max = 0; |
4687 | while (Backup.PhonePhonebook[max]!=NULL) max++; | 4687 | while (Backup.PhonePhonebook[max]!=NULL) max++; |
4688 | printmsgerr("%i entries in backup file\n",max); | 4688 | printmsgerr("%i entries in backup file\n",max); |
4689 | if (answer_yes("Restore phone phonebook")) DoRestore = true; | 4689 | if (answer_yes("Restore phone phonebook")) DoRestore = true; |
4690 | } | 4690 | } |
4691 | } | 4691 | } |
4692 | if (DoRestore) { | 4692 | if (DoRestore) { |
4693 | used = 0; | 4693 | used = 0; |
4694 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { | 4694 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { |
4695 | Pbk.MemoryType = MEM_ME; | 4695 | Pbk.MemoryType = MEM_ME; |
4696 | Pbk.Location= i + 1; | 4696 | Pbk.Location= i + 1; |
4697 | Pbk.EntriesNum= 0; | 4697 | Pbk.EntriesNum= 0; |
4698 | if (used<max) { | 4698 | if (used<max) { |
4699 | if (Backup.PhonePhonebook[used]->Location == Pbk.Location) { | 4699 | if (Backup.PhonePhonebook[used]->Location == Pbk.Location) { |
4700 | Pbk = *Backup.PhonePhonebook[used]; | 4700 | Pbk = *Backup.PhonePhonebook[used]; |
4701 | used++; | 4701 | used++; |
4702 | dbgprintf("Location %i\n",Pbk.Location); | 4702 | dbgprintf("Location %i\n",Pbk.Location); |
4703 | if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); | 4703 | if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); |
4704 | } | 4704 | } |
4705 | } | 4705 | } |
4706 | if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); | 4706 | if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); |
4707 | Print_Error(error); | 4707 | Print_Error(error); |
4708 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); | 4708 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); |
4709 | if (gshutdown) { | 4709 | if (gshutdown) { |
4710 | GSM_Terminate(); | 4710 | GSM_Terminate(); |
4711 | exit(0); | 4711 | exit(0); |
4712 | } | 4712 | } |
4713 | } | 4713 | } |
4714 | printmsgerr("\n"); | 4714 | printmsgerr("\n"); |
4715 | } | 4715 | } |
4716 | 4716 | ||
4717 | DoRestore = false; | 4717 | DoRestore = false; |
4718 | if (Backup.SIMPhonebook[0] != NULL) { | 4718 | if (Backup.SIMPhonebook[0] != NULL) { |
4719 | MemStatus.MemoryType = MEM_SM; | 4719 | MemStatus.MemoryType = MEM_SM; |
4720 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 4720 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
4721 | if (error==ERR_NONE) { | 4721 | if (error==ERR_NONE) { |
4722 | max = 0; | 4722 | max = 0; |
4723 | while (Backup.SIMPhonebook[max]!=NULL) max++; | 4723 | while (Backup.SIMPhonebook[max]!=NULL) max++; |
4724 | printmsgerr("%i entries in backup file\n",max); | 4724 | printmsgerr("%i entries in backup file\n",max); |
4725 | if (answer_yes("Restore SIM phonebook")) DoRestore = true; | 4725 | if (answer_yes("Restore SIM phonebook")) DoRestore = true; |
4726 | } | 4726 | } |
4727 | } | 4727 | } |
4728 | if (DoRestore) { | 4728 | if (DoRestore) { |
4729 | used = 0; | 4729 | used = 0; |
4730 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { | 4730 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { |
4731 | Pbk.MemoryType = MEM_SM; | 4731 | Pbk.MemoryType = MEM_SM; |
4732 | Pbk.Location= i + 1; | 4732 | Pbk.Location= i + 1; |
4733 | Pbk.EntriesNum= 0; | 4733 | Pbk.EntriesNum= 0; |
4734 | if (used<max) { | 4734 | if (used<max) { |
4735 | if (Backup.SIMPhonebook[used]->Location == Pbk.Location) { | 4735 | if (Backup.SIMPhonebook[used]->Location == Pbk.Location) { |
4736 | Pbk = *Backup.SIMPhonebook[used]; | 4736 | Pbk = *Backup.SIMPhonebook[used]; |
4737 | used++; | 4737 | used++; |
4738 | dbgprintf("Location %i\n",Pbk.Location); | 4738 | dbgprintf("Location %i\n",Pbk.Location); |
4739 | if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); | 4739 | if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); |
4740 | } | 4740 | } |
4741 | } | 4741 | } |
4742 | if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); | 4742 | if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); |
4743 | Print_Error(error); | 4743 | Print_Error(error); |
4744 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); | 4744 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); |
4745 | if (gshutdown) { | 4745 | if (gshutdown) { |
4746 | GSM_Terminate(); | 4746 | GSM_Terminate(); |
4747 | exit(0); | 4747 | exit(0); |
4748 | } | 4748 | } |
4749 | } | 4749 | } |
4750 | printmsgerr("\n"); | 4750 | printmsgerr("\n"); |
4751 | } | 4751 | } |
4752 | 4752 | ||
4753 | DoRestore = false; | 4753 | DoRestore = false; |
4754 | if (Backup.CallerLogos[0] != NULL) { | 4754 | if (Backup.CallerLogos[0] != NULL) { |
4755 | Bitmap.Type = GSM_CallerGroupLogo; | 4755 | Bitmap.Type = GSM_CallerGroupLogo; |
4756 | Bitmap.Location = 1; | 4756 | Bitmap.Location = 1; |
4757 | error=Phone->GetBitmap(&s,&Bitmap); | 4757 | error=Phone->GetBitmap(&s,&Bitmap); |
4758 | if (error == ERR_NONE) { | 4758 | if (error == ERR_NONE) { |
4759 | if (answer_yes("Restore caller groups and logos")) DoRestore = true; | 4759 | if (answer_yes("Restore caller groups and logos")) DoRestore = true; |
4760 | } | 4760 | } |
4761 | } | 4761 | } |
4762 | if (DoRestore) { | 4762 | if (DoRestore) { |
4763 | max = 0; | 4763 | max = 0; |
4764 | while (Backup.CallerLogos[max]!=NULL) max++; | 4764 | while (Backup.CallerLogos[max]!=NULL) max++; |
4765 | for (i=0;i<max;i++) { | 4765 | for (i=0;i<max;i++) { |
4766 | error=Phone->SetBitmap(&s,Backup.CallerLogos[i]); | 4766 | error=Phone->SetBitmap(&s,Backup.CallerLogos[i]); |
4767 | Print_Error(error); | 4767 | Print_Error(error); |
4768 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4768 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4769 | if (gshutdown) { | 4769 | if (gshutdown) { |
4770 | GSM_Terminate(); | 4770 | GSM_Terminate(); |
4771 | exit(0); | 4771 | exit(0); |
4772 | } | 4772 | } |
4773 | } | 4773 | } |
4774 | printmsgerr("\n"); | 4774 | printmsgerr("\n"); |
4775 | } | 4775 | } |
4776 | 4776 | ||
4777 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { | 4777 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { |
4778 | if (answer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")) { | 4778 | if ( true /*LRanswer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")*/) { |
4779 | GSM_GetCurrentDateTime(&date_time); | 4779 | GSM_GetCurrentDateTime(&date_time); |
4780 | 4780 | ||
4781 | error=Phone->SetDateTime(&s, &date_time); | 4781 | error=Phone->SetDateTime(&s, &date_time); |
4782 | Print_Error(error); | 4782 | Print_Error(error); |
4783 | } | 4783 | } |
4784 | } | 4784 | } |
4785 | DoRestore = false; | 4785 | DoRestore = false; |
4786 | if (Backup.Calendar[0] != NULL) { | 4786 | if (Backup.Calendar[0] != NULL) { |
4787 | /* N6110 doesn't support getting calendar status */ | 4787 | /* N6110 doesn't support getting calendar status */ |
4788 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 4788 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
4789 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { | 4789 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { |
4790 | max = 0; | 4790 | max = 0; |
4791 | while (Backup.Calendar[max] != NULL) max++; | 4791 | while (Backup.Calendar[max] != NULL) max++; |
4792 | printmsgerr("%i entries in backup file\n",max); | 4792 | printmsgerr("%i entries in backup file\n",max); |
4793 | // LR | 4793 | // LR |
4794 | //if (answer_yes("Restore calendar notes")) { | 4794 | //if (answer_yes("Restore calendar notes")) { |
4795 | //Past = answer_yes("Restore notes from the past"); | 4795 | //Past = answer_yes("Restore notes from the past"); |
4796 | DoRestore = true; | 4796 | DoRestore = true; |
4797 | //} | 4797 | //} |
4798 | } | 4798 | } |
4799 | } | 4799 | } |
4800 | if (DoRestore) { | 4800 | if (DoRestore) { |
4801 | printmsgerr("Deleting old notes: "); | 4801 | printmsgerr("Deleting old notes: "); |
4802 | error = Phone->DeleteAllCalendar(&s); | 4802 | error = Phone->DeleteAllCalendar(&s); |
4803 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 4803 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
4804 | while (1) { | 4804 | while (1) { |
4805 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 4805 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
4806 | if (error != ERR_NONE) break; | 4806 | if (error != ERR_NONE) break; |
4807 | error = Phone->DeleteCalendar(&s,&Calendar); | 4807 | error = Phone->DeleteCalendar(&s,&Calendar); |
4808 | Print_Error(error); | 4808 | Print_Error(error); |
4809 | printmsgerr("*"); | 4809 | printmsgerr("*"); |
4810 | } | 4810 | } |
4811 | printmsgerr("\n"); | 4811 | printmsgerr("\n"); |
4812 | } else { | 4812 | } else { |
4813 | printmsgerr("Done\n"); | 4813 | printmsgerr("Done\n"); |
4814 | Print_Error(error); | 4814 | Print_Error(error); |
4815 | } | 4815 | } |
4816 | 4816 | ||
4817 | for (i=0;i<max;i++) { | 4817 | for (i=0;i<max;i++) { |
4818 | if (!Past && IsCalendarNoteFromThePast(Backup.Calendar[i])) continue; | 4818 | if (!Past && IsCalendarNoteFromThePast(Backup.Calendar[i])) continue; |
4819 | 4819 | ||
4820 | Calendar = *Backup.Calendar[i]; | 4820 | Calendar = *Backup.Calendar[i]; |
4821 | error=Phone->AddCalendar(&s,&Calendar); | 4821 | error=Phone->AddCalendar(&s,&Calendar); |
4822 | Print_Error(error); | 4822 | Print_Error(error); |
4823 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4823 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4824 | if (gshutdown) { | 4824 | if (gshutdown) { |
4825 | GSM_Terminate(); | 4825 | GSM_Terminate(); |
4826 | exit(0); | 4826 | exit(0); |
4827 | } | 4827 | } |
4828 | } | 4828 | } |
4829 | printmsgerr("\n"); | 4829 | printmsgerr("\n"); |
4830 | } | 4830 | } |
4831 | 4831 | ||
4832 | DoRestore = false; | 4832 | DoRestore = false; |
4833 | if (Backup.ToDo[0] != NULL) { | 4833 | if (Backup.ToDo[0] != NULL) { |
4834 | error = Phone->GetToDoStatus(&s,&ToDoStatus); | 4834 | error = Phone->GetToDoStatus(&s,&ToDoStatus); |
4835 | if (error == ERR_NONE) { | 4835 | if (error == ERR_NONE) { |
4836 | max = 0; | 4836 | max = 0; |
4837 | while (Backup.ToDo[max]!=NULL) max++; | 4837 | while (Backup.ToDo[max]!=NULL) max++; |
4838 | printmsgerr("%i entries in backup file\n",max); | 4838 | printmsgerr("%i entries in backup file\n",max); |
4839 | 4839 | ||
4840 | //LR if (answer_yes("Restore ToDo")) | 4840 | //LR if (answer_yes("Restore ToDo")) |
4841 | DoRestore = true; | 4841 | DoRestore = true; |
4842 | } | 4842 | } |
4843 | } | 4843 | } |
4844 | if (DoRestore) { | 4844 | if (DoRestore) { |
4845 | ToDo = *Backup.ToDo[0]; | 4845 | ToDo = *Backup.ToDo[0]; |
4846 | error = Phone->SetToDo(&s,&ToDo); | 4846 | error = Phone->SetToDo(&s,&ToDo); |
4847 | } | 4847 | } |
4848 | if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) { | 4848 | if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) { |
4849 | printmsgerr("Deleting old ToDo: "); | 4849 | printmsgerr("Deleting old ToDo: "); |
4850 | error=Phone->DeleteAllToDo(&s); | 4850 | error=Phone->DeleteAllToDo(&s); |
4851 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 4851 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
4852 | while (1) { | 4852 | while (1) { |
4853 | error = Phone->GetNextToDo(&s,&ToDo,true); | 4853 | error = Phone->GetNextToDo(&s,&ToDo,true); |
4854 | if (error != ERR_NONE) break; | 4854 | if (error != ERR_NONE) break; |
4855 | error = Phone->DeleteToDo(&s,&ToDo); | 4855 | error = Phone->DeleteToDo(&s,&ToDo); |
4856 | Print_Error(error); | 4856 | Print_Error(error); |
4857 | printmsgerr("*"); | 4857 | printmsgerr("*"); |
4858 | } | 4858 | } |
4859 | printmsgerr("\n"); | 4859 | printmsgerr("\n"); |
4860 | } else { | 4860 | } else { |
4861 | printmsgerr("Done\n"); | 4861 | printmsgerr("Done\n"); |
4862 | Print_Error(error); | 4862 | Print_Error(error); |
4863 | } | 4863 | } |
4864 | 4864 | ||
4865 | for (i=0;i<max;i++) { | 4865 | for (i=0;i<max;i++) { |
4866 | ToDo = *Backup.ToDo[i]; | 4866 | ToDo = *Backup.ToDo[i]; |
4867 | ToDo.Location = 0; | 4867 | ToDo.Location = 0; |
4868 | error=Phone->AddToDo(&s,&ToDo); | 4868 | error=Phone->AddToDo(&s,&ToDo); |
4869 | Print_Error(error); | 4869 | Print_Error(error); |
4870 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4870 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4871 | if (gshutdown) { | 4871 | if (gshutdown) { |
4872 | GSM_Terminate(); | 4872 | GSM_Terminate(); |
4873 | exit(0); | 4873 | exit(0); |
4874 | } | 4874 | } |
@@ -5113,193 +5113,193 @@ static void Restore(int argc, char *argv[]) | |||
5113 | } | 5113 | } |
5114 | if (DoRestore) { | 5114 | if (DoRestore) { |
5115 | max = 0; | 5115 | max = 0; |
5116 | while (Backup.GPRSPoint[max]!=NULL) max++; | 5116 | while (Backup.GPRSPoint[max]!=NULL) max++; |
5117 | for (i=0;i<max;i++) { | 5117 | for (i=0;i<max;i++) { |
5118 | error=Phone->SetGPRSAccessPoint(&s,Backup.GPRSPoint[i]); | 5118 | error=Phone->SetGPRSAccessPoint(&s,Backup.GPRSPoint[i]); |
5119 | Print_Error(error); | 5119 | Print_Error(error); |
5120 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5120 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5121 | if (gshutdown) { | 5121 | if (gshutdown) { |
5122 | GSM_Terminate(); | 5122 | GSM_Terminate(); |
5123 | exit(0); | 5123 | exit(0); |
5124 | } | 5124 | } |
5125 | } | 5125 | } |
5126 | printmsgerr("\n"); | 5126 | printmsgerr("\n"); |
5127 | } | 5127 | } |
5128 | 5128 | ||
5129 | GSM_Terminate(); | 5129 | GSM_Terminate(); |
5130 | } | 5130 | } |
5131 | 5131 | ||
5132 | static void AddNew(int argc, char *argv[]) | 5132 | static void AddNew(int argc, char *argv[]) |
5133 | { | 5133 | { |
5134 | GSM_Backup Backup; | 5134 | GSM_Backup Backup; |
5135 | GSM_DateTime date_time; | 5135 | GSM_DateTime date_time; |
5136 | GSM_MemoryEntry Pbk; | 5136 | GSM_MemoryEntry Pbk; |
5137 | GSM_MemoryStatusMemStatus; | 5137 | GSM_MemoryStatusMemStatus; |
5138 | GSM_ToDoEntry ToDo; | 5138 | GSM_ToDoEntry ToDo; |
5139 | GSM_ToDoStatus ToDoStatus; | 5139 | GSM_ToDoStatus ToDoStatus; |
5140 | GSM_CalendarEntryCalendar; | 5140 | GSM_CalendarEntryCalendar; |
5141 | GSM_WAPBookmark Bookmark; | 5141 | GSM_WAPBookmark Bookmark; |
5142 | int i, max, j; | 5142 | int i, max, j; |
5143 | 5143 | ||
5144 | error=GSM_ReadBackupFile(argv[2],&Backup); | 5144 | error=GSM_ReadBackupFile(argv[2],&Backup); |
5145 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); | 5145 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
5146 | 5146 | ||
5147 | signal(SIGINT, interrupt); | 5147 | signal(SIGINT, interrupt); |
5148 | printmsgerr("Press Ctrl+C to break...\n"); | 5148 | printmsgerr("Press Ctrl+C to break...\n"); |
5149 | 5149 | ||
5150 | if (Backup.DateTimeAvailable) printmsgerr("Time of backup : %s\n",OSDateTime(Backup.DateTime,false)); | 5150 | if (Backup.DateTimeAvailable) printmsgerr("Time of backup : %s\n",OSDateTime(Backup.DateTime,false)); |
5151 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); | 5151 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); |
5152 | if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); | 5152 | if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); |
5153 | 5153 | ||
5154 | GSM_Init(true); | 5154 | GSM_Init(true); |
5155 | 5155 | ||
5156 | if (Backup.PhonePhonebook[0] != NULL) { | 5156 | if (Backup.PhonePhonebook[0] != NULL) { |
5157 | MemStatus.MemoryType = MEM_ME; | 5157 | MemStatus.MemoryType = MEM_ME; |
5158 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 5158 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
5159 | if (error==ERR_NONE) { | 5159 | if (error==ERR_NONE) { |
5160 | max = 0; | 5160 | max = 0; |
5161 | while (Backup.PhonePhonebook[max]!=NULL) max++; | 5161 | while (Backup.PhonePhonebook[max]!=NULL) max++; |
5162 | printmsgerr("%i entries in backup file\n",max); | 5162 | printmsgerr("%i entries in backup file\n",max); |
5163 | if (MemStatus.MemoryFree < max) { | 5163 | if (MemStatus.MemoryFree < max) { |
5164 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); | 5164 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); |
5165 | } else if (answer_yes("Add phone phonebook entries")) { | 5165 | } else if (answer_yes("Add phone phonebook entries")) { |
5166 | for (i=0;i<max;i++) { | 5166 | for (i=0;i<max;i++) { |
5167 | Pbk = *Backup.PhonePhonebook[i]; | 5167 | Pbk = *Backup.PhonePhonebook[i]; |
5168 | Pbk.MemoryType = MEM_ME; | 5168 | Pbk.MemoryType = MEM_ME; |
5169 | error=Phone->AddMemory(&s, &Pbk); | 5169 | error=Phone->AddMemory(&s, &Pbk); |
5170 | Print_Error(error); | 5170 | Print_Error(error); |
5171 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5171 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5172 | if (gshutdown) { | 5172 | if (gshutdown) { |
5173 | GSM_Terminate(); | 5173 | GSM_Terminate(); |
5174 | exit(0); | 5174 | exit(0); |
5175 | } | 5175 | } |
5176 | } | 5176 | } |
5177 | printmsgerr("\n"); | 5177 | printmsgerr("\n"); |
5178 | } | 5178 | } |
5179 | } | 5179 | } |
5180 | } | 5180 | } |
5181 | if (Backup.SIMPhonebook[0] != NULL) { | 5181 | if (Backup.SIMPhonebook[0] != NULL) { |
5182 | MemStatus.MemoryType = MEM_SM; | 5182 | MemStatus.MemoryType = MEM_SM; |
5183 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 5183 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
5184 | if (error==ERR_NONE) { | 5184 | if (error==ERR_NONE) { |
5185 | max = 0; | 5185 | max = 0; |
5186 | while (Backup.SIMPhonebook[max]!=NULL) max++; | 5186 | while (Backup.SIMPhonebook[max]!=NULL) max++; |
5187 | printmsgerr("%i entries in backup file\n",max); | 5187 | printmsgerr("%i entries in backup file\n",max); |
5188 | if (MemStatus.MemoryFree < max) { | 5188 | if (MemStatus.MemoryFree < max) { |
5189 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); | 5189 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); |
5190 | } else if (answer_yes("Add SIM phonebook entries")) { | 5190 | } else if (answer_yes("Add SIM phonebook entries")) { |
5191 | j = 1; | 5191 | j = 1; |
5192 | for (i=0;i<max;i++) { | 5192 | for (i=0;i<max;i++) { |
5193 | Pbk = *Backup.SIMPhonebook[i]; | 5193 | Pbk = *Backup.SIMPhonebook[i]; |
5194 | Pbk.MemoryType = MEM_SM; | 5194 | Pbk.MemoryType = MEM_SM; |
5195 | error=Phone->AddMemory(&s, &Pbk); | 5195 | error=Phone->AddMemory(&s, &Pbk); |
5196 | Print_Error(error); | 5196 | Print_Error(error); |
5197 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5197 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5198 | if (gshutdown) { | 5198 | if (gshutdown) { |
5199 | GSM_Terminate(); | 5199 | GSM_Terminate(); |
5200 | exit(0); | 5200 | exit(0); |
5201 | } | 5201 | } |
5202 | } | 5202 | } |
5203 | printmsgerr("\n"); | 5203 | printmsgerr("\n"); |
5204 | } | 5204 | } |
5205 | } | 5205 | } |
5206 | } | 5206 | } |
5207 | 5207 | ||
5208 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { | 5208 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { |
5209 | if (answer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")) { | 5209 | if (true /*LRanswer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")*/) { |
5210 | GSM_GetCurrentDateTime(&date_time); | 5210 | GSM_GetCurrentDateTime(&date_time); |
5211 | 5211 | ||
5212 | error=Phone->SetDateTime(&s, &date_time); | 5212 | error=Phone->SetDateTime(&s, &date_time); |
5213 | Print_Error(error); | 5213 | Print_Error(error); |
5214 | } | 5214 | } |
5215 | } | 5215 | } |
5216 | if (Backup.Calendar[0] != NULL) { | 5216 | if (Backup.Calendar[0] != NULL) { |
5217 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 5217 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
5218 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { | 5218 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { |
5219 | if (answer_yes("Add calendar notes")) { | 5219 | if (answer_yes("Add calendar notes")) { |
5220 | max = 0; | 5220 | max = 0; |
5221 | while (Backup.Calendar[max]!=NULL) max++; | 5221 | while (Backup.Calendar[max]!=NULL) max++; |
5222 | for (i=0;i<max;i++) { | 5222 | for (i=0;i<max;i++) { |
5223 | Calendar = *Backup.Calendar[i]; | 5223 | Calendar = *Backup.Calendar[i]; |
5224 | error=Phone->AddCalendar(&s,&Calendar); | 5224 | error=Phone->AddCalendar(&s,&Calendar); |
5225 | Print_Error(error); | 5225 | Print_Error(error); |
5226 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5226 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5227 | if (gshutdown) { | 5227 | if (gshutdown) { |
5228 | GSM_Terminate(); | 5228 | GSM_Terminate(); |
5229 | exit(0); | 5229 | exit(0); |
5230 | } | 5230 | } |
5231 | } | 5231 | } |
5232 | printmsgerr("\n"); | 5232 | printmsgerr("\n"); |
5233 | } | 5233 | } |
5234 | } | 5234 | } |
5235 | } | 5235 | } |
5236 | if (Backup.ToDo[0] != NULL) { | 5236 | if (Backup.ToDo[0] != NULL) { |
5237 | ToDo.Location = 1; | 5237 | ToDo.Location = 1; |
5238 | error=Phone->GetToDoStatus(&s,&ToDoStatus); | 5238 | error=Phone->GetToDoStatus(&s,&ToDoStatus); |
5239 | if (error == ERR_NONE) { | 5239 | if (error == ERR_NONE) { |
5240 | if (answer_yes("Add ToDo")) { | 5240 | if (answer_yes("Add ToDo")) { |
5241 | max = 0; | 5241 | max = 0; |
5242 | while (Backup.ToDo[max]!=NULL) max++; | 5242 | while (Backup.ToDo[max]!=NULL) max++; |
5243 | for (i=0;i<max;i++) { | 5243 | for (i=0;i<max;i++) { |
5244 | ToDo = *Backup.ToDo[i]; | 5244 | ToDo = *Backup.ToDo[i]; |
5245 | error = Phone->AddToDo(&s,&ToDo); | 5245 | error = Phone->AddToDo(&s,&ToDo); |
5246 | Print_Error(error); | 5246 | Print_Error(error); |
5247 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5247 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5248 | if (gshutdown) { | 5248 | if (gshutdown) { |
5249 | GSM_Terminate(); | 5249 | GSM_Terminate(); |
5250 | exit(0); | 5250 | exit(0); |
5251 | } | 5251 | } |
5252 | } | 5252 | } |
5253 | printmsgerr("\n"); | 5253 | printmsgerr("\n"); |
5254 | } | 5254 | } |
5255 | } | 5255 | } |
5256 | } | 5256 | } |
5257 | if (Backup.WAPBookmark[0] != NULL) { | 5257 | if (Backup.WAPBookmark[0] != NULL) { |
5258 | Bookmark.Location = 1; | 5258 | Bookmark.Location = 1; |
5259 | error = Phone->GetWAPBookmark(&s,&Bookmark); | 5259 | error = Phone->GetWAPBookmark(&s,&Bookmark); |
5260 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { | 5260 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { |
5261 | if (answer_yes("Add WAP bookmarks")) { | 5261 | if (answer_yes("Add WAP bookmarks")) { |
5262 | max = 0; | 5262 | max = 0; |
5263 | while (Backup.WAPBookmark[max]!=NULL) max++; | 5263 | while (Backup.WAPBookmark[max]!=NULL) max++; |
5264 | for (i=0;i<max;i++) { | 5264 | for (i=0;i<max;i++) { |
5265 | Bookmark = *Backup.WAPBookmark[i]; | 5265 | Bookmark = *Backup.WAPBookmark[i]; |
5266 | Bookmark.Location = 0; | 5266 | Bookmark.Location = 0; |
5267 | error=Phone->SetWAPBookmark(&s,&Bookmark); | 5267 | error=Phone->SetWAPBookmark(&s,&Bookmark); |
5268 | Print_Error(error); | 5268 | Print_Error(error); |
5269 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5269 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5270 | if (gshutdown) { | 5270 | if (gshutdown) { |
5271 | GSM_Terminate(); | 5271 | GSM_Terminate(); |
5272 | exit(0); | 5272 | exit(0); |
5273 | } | 5273 | } |
5274 | } | 5274 | } |
5275 | printmsgerr("\n"); | 5275 | printmsgerr("\n"); |
5276 | } | 5276 | } |
5277 | } | 5277 | } |
5278 | } | 5278 | } |
5279 | 5279 | ||
5280 | GSM_Terminate(); | 5280 | GSM_Terminate(); |
5281 | } | 5281 | } |
5282 | #endif | 5282 | #endif |
5283 | 5283 | ||
5284 | static void ClearAll(int argc, char *argv[]) | 5284 | static void ClearAll(int argc, char *argv[]) |
5285 | { | 5285 | { |
5286 | GSM_MemoryStatusMemStatus; | 5286 | GSM_MemoryStatusMemStatus; |
5287 | GSM_ToDoStatus ToDoStatus; | 5287 | GSM_ToDoStatus ToDoStatus; |
5288 | GSM_CalendarEntryCalendar; | 5288 | GSM_CalendarEntryCalendar; |
5289 | GSM_ToDoEntry ToDo; | 5289 | GSM_ToDoEntry ToDo; |
5290 | GSM_WAPBookmark Bookmark; | 5290 | GSM_WAPBookmark Bookmark; |
5291 | GSM_FMStation Station; | 5291 | GSM_FMStation Station; |
5292 | GSM_MemoryEntry Pbk; | 5292 | GSM_MemoryEntry Pbk; |
5293 | bool DoClear; | 5293 | bool DoClear; |
5294 | 5294 | ||
5295 | GSM_Init(true); | 5295 | GSM_Init(true); |
5296 | 5296 | ||
5297 | DoClear = false; | 5297 | DoClear = false; |
5298 | MemStatus.MemoryType = MEM_ME; | 5298 | MemStatus.MemoryType = MEM_ME; |
5299 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 5299 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
5300 | if (error==ERR_NONE && MemStatus.MemoryUsed !=0) { | 5300 | if (error==ERR_NONE && MemStatus.MemoryUsed !=0) { |
5301 | if (answer_yes("Delete phone phonebook")) DoClear = true; | 5301 | if (answer_yes("Delete phone phonebook")) DoClear = true; |
5302 | } | 5302 | } |
5303 | if (DoClear) { | 5303 | if (DoClear) { |
5304 | error = Phone->DeleteAllMemory(&s,MEM_ME); | 5304 | error = Phone->DeleteAllMemory(&s,MEM_ME); |
5305 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 5305 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
diff --git a/gammu/gammu.tar.bz2 b/gammu/gammu.tar.bz2 deleted file mode 100644 index 7c921a7..0000000 --- a/gammu/gammu.tar.bz2 +++ b/dev/null | |||
Binary files differ | |||