Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble-iphoneos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2012-01-31 01:30:22 +0400
committerMikkel Krautz <mikkel@krautz.dk>2012-01-31 01:30:22 +0400
commit1e26f5847d8b1c7402e2b1f8ec2de8307db35bd5 (patch)
treefaa624d7fe34f75719023de444a7e4f472ee7f10
parent3084e2b2cc14e9e6aa5e98ca4aecb6993643055a (diff)
Show welcome message in messages tab.
m---------MumbleKit0
-rw-r--r--Source/Classes/MUMessagesViewController.m23
2 files changed, 23 insertions, 0 deletions
diff --git a/MumbleKit b/MumbleKit
-Subproject a3480b26b8af8eab7d23343a0b5c601f9e7996c
+Subproject 137f75a9d291dba5109c346cf6bf36036e84f1c
diff --git a/Source/Classes/MUMessagesViewController.m b/Source/Classes/MUMessagesViewController.m
index ab476ae..c6618ec 100644
--- a/Source/Classes/MUMessagesViewController.m
+++ b/Source/Classes/MUMessagesViewController.m
@@ -450,6 +450,29 @@
#pragma mark - MKServerModel delegate
+- (void) serverModel:(MKServerModel *)model joinedServerAsUser:(MKUser *)user withWelcomeMessage:(MKTextMessage *)msg {
+ NSString *plainMsg = [msg plainTextString];
+ plainMsg = [plainMsg stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+ NSMutableArray *imageArray = [[[NSMutableArray alloc] initWithCapacity:[[msg embeddedImages] count]] autorelease];
+ for (NSString *dataUrl in [msg embeddedImages]) {
+ UIImage *img = [MUDataURL imageFromDataURL:dataUrl];
+ if (img != nil) {
+ [imageArray addObject:img];
+ }
+ }
+ [_messages addObject:[MUTextMessage textMessageWithHeading:@"Welcome Message"
+ andMessage:plainMsg
+ andEmbeddedLinks:[msg embeddedLinks]
+ andEmbeddedImages:imageArray
+ isSentBySelf:NO]];
+
+ NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[_messages count]-1 inSection:0];
+ [_tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
+ if (![_tableView isDragging] && ![[UIMenuController sharedMenuController] isMenuVisible]) {
+ [_tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
+ }
+}
+
- (void) serverModel:(MKServerModel *)model userMoved:(MKUser *)user toChannel:(MKChannel *)chan fromChannel:(MKChannel *)prevChan byUser:(MKUser *)mover {
if (user == [_model connectedUser]) {
// Are we in 'send to default channel mode'?