| 159 | | [[adium interfaceController] setActiveChat:chat]; |
|---|
| 160 | | |
|---|
| 161 | | message = [NSAttributedString stringWithData:[details objectForKey:KEY_MESSAGE_SEND_MESSAGE]]; |
|---|
| 162 | | |
|---|
| 163 | | //Prepare the content object we're sending |
|---|
| 164 | | AIContentMessage *content = [AIContentMessage messageInChat:chat |
|---|
| 165 | | withSource:account |
|---|
| 166 | | destination:contact |
|---|
| 167 | | date:nil |
|---|
| 168 | | message:message |
|---|
| 169 | | autoreply:NO]; |
|---|
| 170 | | |
|---|
| 171 | | //Send the content |
|---|
| 172 | | success = [[adium contentController] sendContentObject:content]; |
|---|
| 173 | | AILogWithSignature(@"%@ %@ to %@ from %@ in %@", (success ? @"Sent" : @"Failed to send"), content, contact, account, chat); |
|---|
| 174 | | |
|---|
| 175 | | //Display an error message if the message was not delivered |
|---|
| 176 | | if (!success) { |
|---|
| 177 | | [[adium interfaceController] handleMessage:AILocalizedString(@"Contact Alert Error",nil) |
|---|
| 178 | | withDescription:[NSString stringWithFormat:AILocalizedString(@"Unable to send message to %@.",nil), [contact displayName]] |
|---|
| 179 | | withWindowTitle:@""]; |
|---|
| | 159 | if (([chat messageSendingAbility] == AIChatCanSendMessageNow) || |
|---|
| | 160 | ([chat messageSendingAbility] == AIChatCanSendViaServersideOfflineMessage)) { |
|---|
| | 161 | [[adium interfaceController] setActiveChat:chat]; |
|---|
| | 162 | |
|---|
| | 163 | message = [NSAttributedString stringWithData:[details objectForKey:KEY_MESSAGE_SEND_MESSAGE]]; |
|---|
| | 164 | |
|---|
| | 165 | //Prepare the content object we're sending |
|---|
| | 166 | AIContentMessage *content = [AIContentMessage messageInChat:chat |
|---|
| | 167 | withSource:account |
|---|
| | 168 | destination:contact |
|---|
| | 169 | date:nil |
|---|
| | 170 | message:message |
|---|
| | 171 | autoreply:NO]; |
|---|
| | 172 | |
|---|
| | 173 | //Send the content |
|---|
| | 174 | success = [[adium contentController] sendContentObject:content]; |
|---|
| | 175 | AILogWithSignature(@"%@ %@ to %@ from %@ in %@", (success ? @"Sent" : @"Failed to send"), content, contact, account, chat); |
|---|
| | 176 | |
|---|
| | 177 | //Display an error message if the message was not delivered |
|---|
| | 178 | if (!success) { |
|---|
| | 179 | [[adium interfaceController] handleMessage:AILocalizedString(@"Contact Alert Error",nil) |
|---|
| | 180 | withDescription:[NSString stringWithFormat:AILocalizedString(@"Unable to send message to %@.",nil), [contact displayName]] |
|---|
| | 181 | withWindowTitle:@""]; |
|---|
| | 182 | } |
|---|