10 #include "../../misc/coding/coding.h" 11 #include "../../debug.h" 12 #include "../gsmlogo.h" 15 #include "../gsmring.h" 30 size_t FreeText=0,FreeBytes=0,UsedText=0,Width,Height,x,y,Width2;
31 size_t Used,CopiedText,CopiedSMSText;
74 }
else if (Entry->
Right) { Buffer[4] |= 1;
75 }
else if (Entry->
Center) { Buffer[4] |= 2;
76 }
else Buffer[4] |= 3;
77 if (Entry->
Large) { Buffer[4] |= 4;
78 }
else if (Entry->
Small) { Buffer[4] |= 8;}
79 if (Entry->
Bold) Buffer[4] |= 16;
80 if (Entry->
Italic) Buffer[4] |= 32;
85 if (FreeText == 0)
continue;
110 Buffer[3] = Entry->
Number;
141 Buffer[1] = EncodeLength+1;
176 Buffer[1] = EncodeLength+1;
185 Length = FreeBytes - 3;
186 if (Entry->
Protected) Length = Length - 4;
187 if (Length < 0) Length = 128;
188 if (Length > 128) Length = 128;
195 EncodeLength = Length;
197 if (FreeBytes != 0) {
222 smfprintf(di,
"Used SMS: %ld\n", (
long)Used);
240 Length = FreeBytes - 3;
241 if (Length < 0) Length = 128;
242 if (Length > 128) Length = 128;
248 EncodeLength = Length;
250 if (FreeBytes != 0) {
274 Buffer[1] = EncodeLength+1;
328 Buffer[1] = Length + 1;
343 while (Width % 8 != 0) Width--;
346 if (Width <= 96 && Height <= 128)
break;
361 Buffer[1] = Length + 3;
380 Length = FreeBytes - 3;
381 if (Entry->
Protected) Length = Length - 4;
382 if (Length < 0) Length = 128;
383 if (Length > 128) Length = 128;
387 while (FreeBytes != Width) {
389 while (FreeBytes + Width2 != Width) {
394 FreeBytes = FreeBytes + Width2;
398 smfprintf(di,
"Used SMS: %ld\n", (
long)Used);
416 Length = FreeBytes - 3;
417 if (Length < 0) Length = 128;
418 if (Length > 128) Length = 128;
427 while (FreeBytes != Width) {
429 while (FreeBytes + Width2 != Width) {
439 for (x=0;x<Width2;x++) {
440 for (y=0;y<Height;y++) {
454 Buffer[1] = Length + 3;
456 Buffer[3] = Width2/8;
462 FreeBytes = FreeBytes + Width2;
481 while (Width % 8 != 0) Width--;
492 Buffer[1] = Length + 3;
515 for (i=0;i<SMS->
Number;i++) {
524 for (i=0;i<SMS->
Number;i++) {
534 for (i=0;i<SMS->
Number;i++) {
548 if (Len==0)
return TRUE;
565 BufferLen += Len * 2;
572 BufferLen += Len * 2;
590 int i, w, Pos, UPI = 1, fmt;
591 size_t width, height;
601 for (i=0;i<SMS->
Number;i++) {
604 while (w < SMS->SMS[i].UDH.Length) {
605 if (Info->
EntriesNum + 1 == GSM_MAX_MULTI_SMS) {
606 smfprintf(di,
"Couldn't parse SMS, contains too many EMS parts!\n");
611 smfprintf(di,
"UDH part - linked SMS with 8 bit ID\n");
629 smfprintf(di,
"UDH part - MMS notification\n");
637 smfprintf(di,
"UDH part - linked SMS with 16 bit ID\n");
640 smfprintf(di,
"UDH part - EMS text formatting\n");
661 if ((fmt & 4) == 4) {
664 if ((fmt & 8) == 8) {
667 if ((fmt & 16) == 16) {
670 if ((fmt & 32) == 32) {
673 if ((fmt & 64) == 64) {
676 if ((fmt & 128) == 128) {
683 smfprintf(di,
"UDH part - default EMS sound\n");
698 smfprintf(di,
"UDH part - default EMS animation\n");
710 smfprintf(di,
"UDH part - EMS 16x16 animation\n");
713 smfprintf(di,
"UDH part - EMS 8x8 animation\n");
737 smfprintf(di,
"UDH part - EMS 32x32 picture\n");
740 smfprintf(di,
"UDH part - EMS 16x16 picture\n");
760 smfprintf(di,
"UDH part - EMS variable width bitmap\n");
820 smfprintf(di,
"UDH part - Object Distribution Indicator (Media Rights Protecting) ignored now\n");
GSM_Error GSM_EncodeEMSMultiPartSMS(GSM_Debug_Info *di, GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS, GSM_UDH UDHType)
GSM_RingCommand Commands[GSM_MAX_RINGTONE_NOTES]
unsigned char Text[(GSM_MAX_SMS_LENGTH+1) *2]
gboolean GSM_DecodeMMSIndication(GSM_Debug_Info *di, GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS)
void DumpMessage(GSM_Debug_Info *d, const unsigned char *message, const size_t messagesize)
size_t PHONE_GetBitmapSize(GSM_Phone_Bitmap_Types Type, size_t Width, size_t Height)
GSM_Error GSM_AddSMS_Text_UDH(GSM_Debug_Info *di, GSM_MultiSMSMessage *SMS, GSM_Coding_Type Coding, char *Buffer, size_t BufferLen, gboolean UDH, size_t *UsedText, size_t *CopiedText, size_t *CopiedSMSText)
static gboolean AddEMSText(GSM_SMSMessage *SMS, GSM_MultiPartSMSInfo *Info, int *Pos, int Len)
void PHONE_EncodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *Bitmap)
void GSM_SetDefaultSMSData(GSM_SMSMessage *SMS)
size_t UnicodeLength(const unsigned char *str)
void PHONE_DecodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *Bitmap)
GSM_MultiPartSMSEntry Entries[GSM_MAX_MULTI_SMS]
#define GSM_MAX_SMS_LENGTH
GSM_NoteRingtone NoteTone
void GSM_Find_Free_Used_SMS2(GSM_Debug_Info *di, GSM_Coding_Type Coding, GSM_SMSMessage *SMS, size_t *UsedText, size_t *FreeText, size_t *FreeBytes)
void GSM_ResizeBitmap(GSM_Bitmap *dest, GSM_Bitmap *src, size_t width, size_t height)
void GSM_PrintBitmap(FILE *file, GSM_Bitmap *bitmap)
GSM_Debug_Info GSM_global_debug
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
gboolean GSM_IsPointBitmap(GSM_Bitmap *bmp, int x, int y)
gboolean GSM_DecodeEMSMultiPartSMS(GSM_Debug_Info *di, GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS)
GSM_SMSMessage SMS[GSM_MAX_MULTI_SMS]
GSM_Bitmap Bitmap[GSM_MAX_MULTI_BITMAP]
#define GSM_MAX_MULTI_SMS
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
void GSM_ClearBitmap(GSM_Bitmap *bmp)
void PHONE_GetBitmapWidthHeight(GSM_Phone_Bitmap_Types Type, size_t *width, size_t *height)
int smfprintf(GSM_Debug_Info *d, const char *format,...)
void GSM_EncodeUDHHeader(GSM_Debug_Info *di, GSM_UDHHeader *UDH)
void GSM_ClearPointBitmap(GSM_Bitmap *bmp, int x, int y)
unsigned char GSM_MakeSMSIDFromTime(void)
unsigned char Text[2 *(GSM_BITMAP_TEXT_LENGTH+1)]
void GSM_SetPointBitmap(GSM_Bitmap *bmp, int x, int y)
unsigned char GSM_EncodeEMSSound(GSM_Ringtone *ringtone, unsigned char *package, size_t *maxlength, GSM_RingtoneVersion version, gboolean start)