41 static PANEL *logPanel, *logPanel_border; |
41 static PANEL *logPanel, *logPanel_border; |
42 static int maxY, maxX; |
42 static int maxY, maxX; |
43 static window_entry_t *currentWindow; |
43 static window_entry_t *currentWindow; |
44 |
44 |
45 static int chatmode; |
45 static int chatmode; |
|
46 static int multimode; |
|
47 static char *multiline; |
46 int update_roster; |
48 int update_roster; |
47 int utf8_mode = 0; |
49 int utf8_mode = 0; |
48 |
50 |
49 static char inputLine[INPUTLINE_LENGTH+1]; |
51 static char inputLine[INPUTLINE_LENGTH+1]; |
50 static char *ptr_inputline; |
52 static char *ptr_inputline; |
1084 inline void scr_set_chatmode(int enable) |
1086 inline void scr_set_chatmode(int enable) |
1085 { |
1087 { |
1086 chatmode = enable; |
1088 chatmode = enable; |
1087 } |
1089 } |
1088 |
1090 |
|
1091 // scr_get_multimode() |
|
1092 // Public fonction to get multimode status... |
|
1093 inline int scr_get_multimode() |
|
1094 { |
|
1095 return multimode; |
|
1096 } |
|
1097 |
|
1098 // scr_set_multimode() |
|
1099 // Public fonction to (un)set multimode... |
|
1100 inline void scr_set_multimode(int enable) |
|
1101 { |
|
1102 if (multiline) { |
|
1103 g_free(multiline); |
|
1104 multiline = NULL; |
|
1105 } |
|
1106 if (enable) |
|
1107 multimode = TRUE; |
|
1108 else |
|
1109 multimode = FALSE; |
|
1110 } |
|
1111 |
|
1112 // scr_get_multiline() |
|
1113 // Public fonction to get multimode status... |
|
1114 inline const char *scr_get_multiline() |
|
1115 { |
|
1116 if (multimode && multiline) |
|
1117 return multiline; |
|
1118 else |
|
1119 return ""; |
|
1120 } |
|
1121 |
|
1122 // scr_append_multiline(line) |
|
1123 // Public function to append a line to the current multi-line message. |
|
1124 // Skip empty leading lines. |
|
1125 void scr_append_multiline(const char *line) |
|
1126 { |
|
1127 static int num; |
|
1128 |
|
1129 if (!multimode) { |
|
1130 scr_LogPrint("Error: Not in multi-line message mode!"); |
|
1131 return; |
|
1132 } |
|
1133 if (multiline) { |
|
1134 int len = strlen(multiline)+strlen(line)+2; |
|
1135 if (len >= HBB_BLOCKSIZE) { |
|
1136 // We don't handle single messages with size > HBB_BLOCKSIZE |
|
1137 // (see hbuf) |
|
1138 scr_LogPrint("Your multi-line message is too big, this line has " |
|
1139 "not been added."); |
|
1140 scr_LogPrint("Please send this part now..."); |
|
1141 return; |
|
1142 } |
|
1143 multiline = g_renew(char, multiline, len); |
|
1144 strcat(multiline, "\n"); |
|
1145 strcat(multiline, line); |
|
1146 num++; |
|
1147 } else { |
|
1148 // First message line (we skip leading empty lines) |
|
1149 num = 0; |
|
1150 if (line[0]) { |
|
1151 multiline = g_new(char, strlen(line)+1); |
|
1152 strcpy(multiline, line); |
|
1153 num++; |
|
1154 } else |
|
1155 return; |
|
1156 } |
|
1157 scr_LogPrint("Multi-line mode: line #%d added [%.25s...", num, line); |
|
1158 } |
|
1159 |
1089 // scr_cmdhisto_addline() |
1160 // scr_cmdhisto_addline() |
1090 // Add a line to the inputLine history |
1161 // Add a line to the inputLine history |
1091 inline void scr_cmdhisto_addline(char *line) |
1162 inline void scr_cmdhisto_addline(char *line) |
1092 { |
1163 { |
1093 if (!line || !*line) return; |
1164 if (!line || !*line) return; |